DU : Terminal Command of the day

Want to know the disk usage of any folder quickly using a command in terminal ? Disk space issue; wish to find out which folder/files are eating your disk space ?
The answer to above problem(s) is a simple command : DU (disk usage)



find diskspace used in linux


Usage with important parameters:
du [-a|-h| -s] <path>


-a => All  (include sub files,folders as well)
-h => Human readable format of sizes ( Disk usage o/p in terms of GB, MB,  KB     instead of default bytes which makes it difficult to intercept)
-s => Summarize (display only a total for each argument )

Examples :

To find out the disk usage of folder /home/adithya all i need to issue is:
du -sh /home/adithya

To find out the disk usage of all top level folders and files of /home/adithya (folders and files in /home/adithya)

du -sh /home/adithya/*

To find out the disk usage breakdown(Sub Folder level : details of disk space usage of all sub folders residing) of folder /home/adithya.

du -h /home/adithya

To find out the disk usage breakdown(Folder and files level : details of disk space usage of all sub folders as well as sub files residing) of folder /home/adithya.

 du -ah /home/adithya

Appears simple isn't it ? :)
There are still many options that can be used. In case you are interested issue command
man du
to see all parameters and options possible and its function.

About This Blog

There is something for everyone. !! A tech blog on various topics. Let it be devops, programming etc; we have it all covered here in layman terms :)

Total Pageviews

Back to TOP