Find large files
Eg: Find files larger than 10MB in current directory
The code is as follows:
$ find. -type f-size +10000k-exec ls-lh {} \; | awk ' {print $ ': ' $} '
Sample output:
./.kde/share/apps/akregator/archive/http___blogs.msdn.com_mainfeed.aspx?type=allblogs.mk4:91m
./out/out.tar.gz:828m
./.cache/tracker/file-meta.db:101m
./ubuntu-8.04-desktop-i386.iso:700m
./vivek/out/mp3/eric:230m
List files with a file size of less than 500b in the home directory:
The code is as follows:
$ find $HOME-size-500b
OR
The code is as follows:
$ find ~-size-500b
List the files in the root directory with a size of 512-byte blocks:
The code is as follows:
# Find/-size 20
Find a large directory under Linux
For example, sometimes disk space alarm, and you usually neglect management, monitor the growth of files, then I need to quickly understand which directories become larger, then we can use the du command to help us solve this problem.
The code is as follows:
[root@getlnx01 u03]# du-h--max-depth=1
16K./lost+found
33G./flash_recovery_area
37G./oradata
70G.
If you want to know what large folders are under the Flash_recovery_area directory, you can max-depth=2 the parameters, and if you want to sort the results, you can use the sort command. As shown below
The code is as follows:
[ROOT@GETLNX01 u03]# CD/
[root@getlnx01/]# du-hm--max-depth=2 | Sort-n
Sometimes the result of the search is too much (for example, I started the search from the root directory), has been brushing the screen, if I only want to find out the largest 12 folders, how to do? You need to use the head command to show