Find Directory and File Size in a Terminal

Posted by elliotfriend on February 19, 2013

Here’s a really handy command that I tend to forget exists.

If you’re running out of disk space, it can be really hard to track down a runaway file. Here’s a way you can get some more information.

du -hs /path/to/directory/or/file

This helped me figure out once where my 114GB log file was taking up all my space! Super handy!

EDIT: I will point out that if you are trying to find the size of all files or directories in a given directory, use the asterisk to target them all:

du -hs /home/elliot/*