Estimating Directory Size in Human Readable Format Using du Command

Posted on

Operating System            :  Any Linux Operating System Distribution

To be able to specifically measure the space which is being used by a folder or directory, we can use the following command to do it :

du -sh folder_name

du : it is a command which is used to specifically estimate the space usage used.
-s

 

: It is a parameter which is used to display or print only a total space usage used. We can think that it is an abbreviation of summarize
-h

 

: It is a parameter which is used to display or print the total space usage used in form of size which is a human readable format. For an example in Kilobyte, Megabyte or even Gigabyte.
folder_name : It is the name of the folder which is going to be estimated the size of it using the command du.

For an example :

username@hostname:/var/www/html/web$ du -sh wp-content/
146M     wp-content/
username@ hostname:/var/www/html/web$

The above example is executing the command to measure one folder of WordPress source code web for an example. The output displays the number of the folder size which is specified in the command parameter in a human readable format since there is an additional information in form of ‘M’ symbol which stands for Megabytes.

Save

Save

Save

One thought on “Estimating Directory Size in Human Readable Format Using du Command

Leave a Reply