On this page
Locate Large Files and Directories
Finding Large Directories
To find large directories, use the du command and sort the output.
For example, to output the 10 largest directories in /var, sorted in ascending size order, use the following command:
du -ko /var
To avoid crossing file system boundaries, that is, to see the directory usage in / but not in the other mounted files systems (/var, /opt, and so on), add the d option to the du command:
du -kod /var
Another super useful tool is ncdu. An ncurses disk usage viewer that provides a more user-friendly interface for navigating through directories and their sizes.
ncdu /
Finding Large Files
To find large files, use the find command and sort the output.
- Example 1: To find all plain files (not block, character, symbolic links, and so on) in a file system larger than 200,000 512-byte blocks (approximately 100 Mbytes) and sort on field 7 (file size) while numerically ignoring leading blanks, do this:
find / -size +200000 -type f -ls
- Example 2: To find all plain files (not block, character, symbolic links, and so on) in a /var file system larger than 1,000 512-byte blocks (approximately 500 Kbytes) and sort on field 7 (file size) while numerically ignoring leading blanks, do this:
find /var -size +1000 -type f -ls
Last updated 31 Aug 2008, 10:59 CEST.