Good Linux Tool, find out the biggest file / directory in the system
No matter how big your hard disk is, it can still run out of space someday. So, do some regular cleaning up work is necessary. Free some space by deleting the files which are out of date or not needed anymore.
To get the space consumed by each directory with du and find out the biggest one with sort.
$du --max-depth=1 -h | sort -h -r
Meaning of du options:
--max-depth : print the total size of direcotries on the firest level.
-h : print the size in human readable format (e.g. 1K, 2M, 3G, etc. ).
Meaning of sort options:
-h : sort human readable format numbers.
-r : reverse the result, the biggest number is on the top.
What I need to do is use this command recursively from the root directory ( / ) . It will finally lead me to the file or directory which consumes most of my storage.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.