The linux command du
(see man du
) estimates file space usage. To see the the total size of the directory directory
along with all its subdirectories, do
du -sh direcory/
Here, the -s
parameter shows the total sum of all the files and subdirectories and -h
shows the result in a human readable format.
To show the size of all directory and subdirectory in the current location in ascending order, use
du -sh ./* | sort -h
Here, sort -h
sorts in the human-readable format.
This method does not show you the hidden files or directories. So, here is one trick to do exactly that:
du -sch .[!.]* * | sort -h
The parameter -c
produces a grand total. The shell pattern following the parameters make sure we are searching for all files including the ones that start with a dot. Whatever. There is a program specifically made for disk analyzing and cleanup purposes and it is awesome. It’s called ncdu.
Just install it and run ncdu
and feel the wind.