Finding large directories that consume your disk space can be done instantly using native terminal utilities. These 5 simple terminal commands will immediately isolate your largest folders: 1. The Standard Top 10 Summary
This combined pipeline calculates the size of everything in your current directory, sorts it by human-readable size (e.g., MB, GB), and outputs the top 10 largest items. du -hs| sort -rh | head -10 Use code with caution.
du -hs : Estimates disk usage for each item () in a summary format (-s) and human-readable numbers (-h).
sort -rh: Sorts the results in reverse order (-r) comparing human-readable units (-h).
head -10: Truncates the output to show only the first 10 rows. 2. The Shallow Root Dive
If you want to look across your entire system root (/) without getting bogged down in endless nested subfolders, you can limit the scanning depth. sudo du -h -x –max-depth=1 / | sort -rh Use code with caution.
-x: Prevents the command from jumping into other attached file systems (like external USBs or network drives).
–max-depth=1: Tells the system to only display the sizes of the top-level folders directly inside the root. 3. The Large-Folder Threshold Filter
If you don’t care about small files and only want to find massive directories instantly, use a minimum size filter. du -h –max-depth=2 –threshold=1G 2>/dev/null | sort -rh Use code with caution.
–threshold=1G: Instructs the system to exclusively output directories that are 1 Gigabyte or larger.
Leave a Reply