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) »

@inxilpro

  • Anyone want a free TiVo Series 2 w/ upgrade eligibility and month-to-month service? Its yours if I know you. 1 day ago
  • Just canceled the cable. 1 day ago
  • You know it's spring when the daily Tony Danza sightings start again. 1 day ago
  • More updates...
Copyright © Chris Morrell, Powered by WordPress, Entry RSS Feed / Comment RSS Feed