# Quickly find the largest files and folders that are eating up your disk space
# A practical guide to using "du" and sort to find the top 5 largest directories in Linux
# Check disk usage in the current or any specific path
xinit@localhost:~$ # Top 5 largest files/folders in CURRENT directory:
xinit@localhost:~$ du -sh * | sort -rh | head -n 5
5.7G Downloads
3.8G Share
2.0G Projects
1.6G Pictures
4.4M Documents
xinit@localhost:~$ # Top 5 largest in a SPECIFIC directory (e.g. /var):
xinit@localhost:~$ du -sh /var/* | sort -rh | head -n 5
1001M /var/log
369M /var/lib
91M /var/cache
5.6M /var/backups
60K /var/tmp
# Command breakdown:
# du -sh * -> Shows disk usage for each item
# sort -rh -> Sorts results by size (largest first)
# head -n 5 -> Shows the top 5