There are many ways to find the directory or folder size in Linux. This post discuss few ways to find the size of directory and file using command line.
Using du
du command summarizes disk usage of each file, recursively for directories.
du -hs /path/to/directory
- -h option shows the number in human readable format.
- -s option show the summary, otherwise this command shows not only the size of the folder but also for everything in the folder separately
Using ncdu
ncdu is a interactive tool, that quickly gives you an overview about directory sizes. It also supports
- Faster drill-down through file hierarchy
- Delete files from inside the tool
To install the tool from the command line:
sudo apt-get install ncdu
Using tree
tree is another useful command for this job. To find the size of directory enter below command
tree --du -h /path/to/directory
To install, type the following
sudo apt-get install tree