1. Calculate the number of files in the current directory:
Find WC -l
2. Find the latest and oldest files in the/etc directory, sorted by file time and displayed in the format of year-month-day:
#查找最旧的文件 [[email protected] tmp]#Find/etc/-type f-printf"%t+%p\n"|Sort-N |Head-N1 -- Geneva- A+ +: at:47.0000000000/etc/lsb-release.d/graphics-4.0-ia32# Find the latest file [email protected] tmp]#Find. -type f-printf"%t+ \t%p\n"|Sort-N |Tail-N1 -- ,- .+ +: $:14.4790036700./student.txt
Note: In the printf command output,%t represents the date and time of the file, and%p represents the filename with the path
3. Check the home directory for "." Start with the latest file:
Find " %t+ \t%p\n " grep " ws/\. " Sort Tail 1 £ º+:22.4699979720 /home/ file
4. Find the largest file in the directory, the%s parameter represents the file size, the%f parameter indicates the Include file name
Find " %s \%f\n " Sort Uniq Tail 1 12288 . Crontab.vf6XP3.swp
5. The owner of the statistics file, using the%u parameter, and counting the number of files belonging to the same owner (can be implemented via UNIQ-C):
Find " %u\n " grep " \./\. " Sort Uniq -c , root 1 ws
6. To view the date the file was accessed, use the%a parameter:
[Email protected] tmp]#Find. -type f-printf"%a+%p\n"|SortFri Jul - xx: -:36.0720998929 -+./SH/variable.SHMon-Aug3 at: $:49.0879000520 -+./. Viminfomon Jul - at: One:37.0189000083 -+./SH/if1.SHMon Jul - at: -:30.0823998314 -+./SH/readtest.SHMon Jul - at: -:52.0296995712 -+./SH/readtest,SHMon Jul - at: the:46.0718997111 -+./SH/if2.SH
7. Before running the command, temporarily empty the environment variables, you can use the Env-i command, to modify environment variables (ignoring environment variables), start a shell, the new shell does not have redundant environment variables
SH Env WC -l-shenvenvWC -l0
The Linux Find command is used for statistical information