Skip to content
loading...

Find large files in aws ec2

bighappytrees profile image Aaron Bendersky github logo ・1 min read  

If you work with aws ec2 servers, you know it can be a pain to find some deeply hidden large files sucking away at your storage. Fear not, use du.

sudo du -shx /* | sort -h

It will return something like:

...
4K  /opt
72K /root
764K    /run
29M /etc
39M /boot
256M    /home
889M    /usr
33G /var

Looks like our /var folder could use some further inspection, lets adjust our command:

sudo du -shx /var/* | sort -h

Then we see something like:

...
60K /var/spool
224M    /var/cache
6.2G    /var/log
27G /var/lib

It appears we have two more directories worthy of further digging.

We can adjust our command again to inspect /var/lib/* or /var/log/* respectively.

Good luck!

twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Feb 13 '19

What to learn first

A guide for new developers

Aaron Bendersky profile image
Ruby/Rails developer