To find the largest files in a directory on a Linux system, you can use
ls -lS
to order the directory listing by size with the
largest files at the top of the list and the smallest at the bottom. The
command will show the size of files in bytes, so you may wish to add the
h
parameter to display file sizes in a more human-readable
format, such as kilobytes, megabtyes, etc. depending on the file size,
i.e., ls -lSh
. Often, you will wish to have the largest
files displayed at the bottom of the list. To do so, add the r
parameter, i.e., lS -lShr
.
$ ls -lShr /usr/lib/xorg/modules total 1.2M drwxr-xr-x 2 root root 4.0K 2012-04-23 12:01 multimedia drwxr-xr-x 2 root root 4.0K 2011-10-12 10:30 input drwxr-xr-x 2 root root 4.0K 2012-04-23 12:01 extensions drwxr-xr-x 2 root root 4.0K 2012-04-23 12:16 drivers -rw-r--r-- 1 root root 18K 2011-10-19 01:19 libfbdevhw.so -rw-r--r-- 1 root root 22K 2011-10-19 01:19 libvbe.so -rw-r--r-- 1 root root 26K 2011-10-19 01:19 libshadow.so -rw-r--r-- 1 root root 27K 2011-10-19 01:19 libvgahw.so -rw-r--r-- 1 root root 34K 2011-10-19 01:19 libshadowfb.so -rw-r--r-- 1 root root 98K 2011-10-19 01:19 libexa.so -rw-r--r-- 1 root root 138K 2011-10-19 01:19 libfb.so -rw-r--r-- 1 root root 152K 2011-10-19 01:19 libint10.so -rw-r--r-- 1 root root 178K 2011-10-19 01:19 libwfb.so -rw-r--r-- 1 root root 414K 2011-10-19 01:19 libxaa.so