Monday, 18 March 2013

Find the size of folders in linux

Finding the size of a directory and finding the amount of free disk space that exists on your machine. The command you would use to find the directory size is ' du '. And to find the free disk space you could use ' df '.

$ du
Gives you a list of directories that exist in the current directory along with their sizes. The last line of the output gives you the total size of the current directory including its subdirectories. Note that by default the sizes given are in kilobytes. 

$ du /home
The above command would give you the directory size of the directory /home

$ du -h
This command gives you a better output than the default one. The option '-h' stands for human readable format. So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.

$ du -sh ./*
Give you total size of each folder and files in present folder

Share This!

No comments:

Post a Comment

Here We Write The Problems we face at different situations and Solutions to those problems.