Q. How can I find all the large files in the directory? A.1) syntax forRedHat/CentOS/FedoraLinuxfind {/path/to/directory/}-typef-size + {size-in-kb} k-execls-lh {}\; | awk & lsquo; {print $9 & ldquo;
Q. How can I find all the large files in the directory?
A.
1) syntax for RedHat/CentOS/Fedora Linux
Find {/path/to/directory/}-type f-size + {size-in-kb} k-exec ls-lh {}\; | awk '{print $9 ":" $5 }'
Instance:
Search for files larger than 50 MB in the current directory
$ Find.-type f-size + 50000 k-exec ls-lh {}\; | awk '{print $9 ":" $5 }'
Search for files whose directory/var/log is greater than MB
# Find/var/log-type f-size + 100000 k-exec ls-lh {}\; | awk '{print $9 ":" $5 }'
2) syntax for Debian/Ubuntu Linux
Find {/path/to/directory}-type f-size + {file-size-in-kb} k-exec ls-lh {}\; | awk '{print $8 ":" $5 }'
Instance:
Search for files larger than 10 MB in the current directory
$ Find.-type f-size + 10000 k-exec ls-lh {}\; | awk '{print $8 ":" $5 }'
Sample output:
./. Kde/share/apps/akregator/Archive/http ___ blogs.msdn.com _ MainFeed. aspx? Type = AllBlogs. mk4: 91 M
./Out/out.tar.gz: 828 M
./. Cache/tracker/file-meta.db: 101 M
./Ubuntu-8.04-desktop-i386.iso: 700 M
./Vivek/out/mp3/Eric: 230 M
List files with a file size smaller than B in the home directory:
$ Find $ HOME-size-500b
OR
$ Find ~ -Size-500b
List files with a size of 20 512-byte blocks in the root directory:
# Find/-size 20
Perl tips: display large files
Displays the usage of each directory in the current directory based on the file size from small to large (note: the length of asterisks and stars)
Du-k | sort-n | perl-ne 'if (/^ (\ d +) \ s + (. * $)/) {$ l = log ($1 +. 1); $ m = int ($ l/log (1024); printf ("% 6.1f \ t % s \ t % 25 s % s \ n ", ($1/(2 ** (10 * $ m), ("K", "M", "G", "T", "P ") [$ m]), "*" x (1.5 * $ l), $2 );}'
Ls command: find the largest file in the directory
You can also use the ls command:
$ Ls-lS
$ Ls-lS | less
$ Ls-lS | head + 10
Ls command: Find the smallest file in the directory
As follows:
$ Ls-lSr
$ Ls-lSr | less
$ Ls-lSr | tail-10
Other supply:
Find.-xdev-printf '% s % p \ n' | sort-nr | head-20
Du-xak. | sort-n | tail-50