How to check directory file size on linux (Solution)

hmm… linux whatever also in command line, it really make me uncomfortable, i even need to issue a command to check a directory size.

du -lh

P.S
always issue -h to display file size in human readable format

check-directory-size-on-linux

We can check summary of a directory by issuing

du -sh 

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
trackback
wanted to check size of directory in linux/unix

[…] Hi, see these threads these may helpful http://www.codecoffee.com/tipsforlinux/articles/22.html http://superuser.com/questions/16274…eir-subfolders http://www.mkyong.com/linux/how-to-c…inux-solution/ […]

Tarun Khanna
Guest
Tarun Khanna

Say you wish to get the total size of all the log files or any files in a directory with a similar pattern, you can also use the below command

ls -lrt *.log | gawk ‘{ sum += $5 }; END { print sum }’

Boris
Guest
Boris

Thanks
Like

Vlatko Šurlan
Guest
Vlatko Šurlan
sudej
Guest
sudej

i like too

indika
Guest
indika

i like to learn this command

indika
Guest
indika

i liked