Unfortunately there is not a simple command in Linux to find the largest files and/or directories. However, combining the following three commands (using pipes) can help you locate the largest files/directories on your file system:
- du – Estimate file space usage
- sort – Sort lines of text files or given input data
- head – Output the first part of files i.e. to display the n largest files/directories
In Terminal (command prompt) enter the following to list the top 10 largest files/directories:
sudo du -a / | sort -n -r | head -n 10
Of course this can be used on various directories as well, like usr or var:
sudo du -a /usr | sort -n -r | head -n 10
sudo du -a /var | sort -n -r | head -n 10
NOTE: This works on all flavors or Linux, UNIX and BSD as well – just drop sudo.