About Chris Morrell

I am a Philadelphia web designer and developer who focuses on PHP development and usable design. I am also the Director of IT for the International Association of Certified Home Inspectors.

Please Note: My site fell victim to a Wordpress security flaw a few weeks ago, and I'm just getting everything back to normal. Please bear with me.

I am currently not accepting any new clients.

Other Sites/Clients

Contact Me

If you need to get in touch with me, my name is Chris and my domain name is cmorrell.com. Think about it.

Find oversized files in *nix

Posted by Chris Morrell on April 30th, 2009 in Misc

Every once in a while I run the following command on my servers to hunt out the largest files to make sure nothing’s taking up too much space.  For example, it’s been very useful in hunting down over sized log files or email accounts.  It searches everything over 20MB and outputs the list to bigfiles.txt ordered by size (in MB) descending.

find / -type f -size +20000k -exec ls -la {} \; | sort +4 -nr | awk '{ printf "%-20s %s\n", $5/1048576, $9 }' > bigfiles.txt &

You can exclude a path by adding a little more to the command. The following will do the same as above but exclude the /backup directory:

find / -path '/backup' -prune -o -type f -size +20000k -exec ls -la {} \; | sort +4 -nr | awk '{ printf "%-20s %s\n", $5/1048576, $9 }' > bigfiles.txt &

You can also change the 20000k to whatever you want the smallest files to be.

It’s a fantastic little command and I just thought I’d share it with the world.

No Comments (Respond Now) »

Leave a Reply

Additional comments powered by BackType

Comments & Trackbacks

You can leave a response, or trackback from your own site. Follow any responses to this entry through the RSS 2.0 feed.

More...

@inxilpro

  • Wet Hot American Summer at World Cafe Live. It's free and dead. 2 days ago
  • Would really like something that combines Twitter starred + Google Reader starred/liked + Delicious.com. Does such a thing exist? 6 days ago
  • Also, how can OS X be so rock solid and other Apple-developed software be so buggy? 1 week ago
  • More updates...
Copyright © Chris Morrell, Powered by WordPress, Entry RSS Feed / Comment RSS Feed