Often time, you may need to know which file contains large file size, and delete it to save space. Here’s a code pattern to show you how to find large file size on Linux :

find {directory} -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

1. File size >= 100MB

Find all files that have a size >= 100MB, from root folder and its sub-directories.

sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'


/Applications/Diablo: 2.3G
/Applications/Diablo: 203M
/Applications/Diablo: 978M
/Applications/Diablo: 1.4G
/Applications/Diablo: 1.3G
/Applications/Diablo: 1.5G
/Applications/iPhoto.app/Contents/Resources/PointOfInterest.db: 242M

2. File size >= 50MB

Find all files that have a size >= 50MB, from folder ‘/Users/mkyong’ and its sub-directories.

find /User/mkyong -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'


/Users/mkyong/Downloads/command_line_tools_for_xcode_june_2012.dmg: 147M
/Users/mkyong/Downloads/ubuntu-12.04-desktop-i386.iso: 701M
/Users/mkyong/Downloads/X15-65805.iso: 3.0G
/Users/mkyong/Library/Preferences/com.google.code.sequel-pro.plist: 104M
Above command tested for Ubuntu and Mac OSX.


  1. Unix find command
Tags :
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.
My website mkyong.com is hosted by Liquid Web, I really like their fast and helpful support, it saved me a lot of time. Furthermore, their servers are extremely reliable, fast and stable, I don't remember when was the last time my server is down. Btw, they're offering $100 Coupon now, if you are sourcing for great hosting provider, go grab it.

Related Posts

Popular Posts