Showing the size of a directory using command line in Mac OSX

Today I learned that there’s a command to let us list down the breakdown of the size of each folder:

~/Desktop $ du -h features 
12K   features/step_definitions 
12K   features/support 
32K   features

We can also show the total size of a directory by doing this:

~/Desktop $ du -hc ~/Desktop/ |grep total 4.8G total 
4.8G   total

A useful command to find out breakdown of current directory!

du -cd 1 ./ | sort -nr |head
Advertisements