Sunday, May 18, 2014

Ubuntu: Directory size from terminal

Ubuntu: Directory size from terminal

In this post we gonna see how to find size of a directory from Terminal. To summarise disk usage of each file, recursively for directories, we can use the following command
du [option]... [FILE/Directory]...
To get the report in human readable format, along with the overall summary, use
du -hs /path/to/directory

To find sizes of directories recursively unto a certain depth (e.g.: depth = 2):
du -h --max-depth=2 /path/to/directory