Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X
Post

Find Large Files Fast

We’ve all been there, your 10GB VPS server is running out of space or that 3GB virtual machine your using as a dev server is bursting at the seems and you need to free up some space quickly. 

Use these searches to find the largest files on your server and start clearing up space for more 1′s and 0′s.

Find files over 1GB

sudo find / -type f -size +1000000k -exec ls -lh {} \;

Find files over 100MB

sudo find / -type f -size +100000k -exec ls -lh {} \;

Find files over 10MB

sudo find / -type f -size +10000k -exec ls -lh {} \;

The first part is the find command we’ve gone over before except this time we’re using the “-size” flag to find files over different sizes measured in kilobytes.

The last bit on the end starting with “-exec” allows us to specify a command we want to execute on each file we find. Here we’re executing the “ls -lh” command to include all the information we’re used to seeing when listing the contents of a directory. The h towards the end is especially helpful as it prints out the size of each file in a human readable format i.e. Megs and Gigs.

Happy pruning!

  • http://www.davidglover.org/ David

    I prefer to use “du” to list the largest things on the filesystem. No need them to guess what size the largest files might be.

    du -ma / | sort -nr | head -n 20

  • http://rawberg.com/blog David Feinberg

    Thanks for sharing that tip David, using “du” is a great alternative!

  • betterdeal

    Marvellous! Just what I needed – thanks :)

  • Keola Malone

    This find command works great. Small tip: throw an -xdev (http://manpages.ubuntu.com/manpages/intrepid/man1/find.1.html) on your find command to restrict it to one file system. This way you can pinpoint whatever partition is full/filling up.

  • http://rawberg.com/blog David Feinberg

    great tip!

  • Julien Vander Straeten

    T H A N K S!

  • sudeeraka

    Thank you :)

  • http://rawberg.com/blog David Feinberg

    Glad it was helpful. The GUI app will make this even easier :)