Find Directory and File Size in a Terminal


This is something that should be in your toolbelt!

Posted by elliotfriend on February 19, 2013

Find Directory and File Size in a Terminal

This is something that should be in your toolbelt!

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 114GB log file was taking up all my space! Super handy!

I will note 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/*

Photo by Sandia Labs