Main Tutorials

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 Author

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

Comments

Subscribe
Notify of
6 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Tarun Khanna
11 years ago

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
11 years ago

Thanks
Like

Vlatko Šurlan
13 years ago
sudej
15 years ago

i like too

indika
15 years ago

i like to learn this command

indika
15 years ago

i liked