General Mac OS X Discussion General Apple and Mac OS X Discussion

Thread Tools Display Modes
  (#1) Old
dacodo dacodo is offline
Junior Member
Posts: 5
Join Date: May 2009
Default Command for finding large files - 10-08-2009, 02:38 PM

I had a crazy problem this morning all of a sudden I was missing 5GB from my SSD. After doing a "get info" on all my directories it was still nowhere to be seen.

Anyway I used this command to find the offending log files that had exploded and the sleep file that had shown back up. Thought you guys may find it handy in your constant file space war. (hint: I usually eject any external and SDHC drives before I run it, to make it faster)

find / -size +50000 -exec ls -s {} \; | sort -nr | more

Takes a bit to run, but it will be sorted by file size and it's easy to spot SSD hogs. Most things in /var/logs is safe to ax if you don't need that info. (I usually tail the logs before I nuke them just to make sure there isn't info in there I need.)

Mini 9 | 1.6GHz Atom | 2GB RAM | 16GB RunCore SSD + 16GB SDHC | OSX 10.6.2 | Apple Airport Wireless-N |
G4 Case | 3GHz Core 2 Duo | GA-G31M-ES2L | 4GB RAM | 1TB | GeForce 9800 GT+ 512MB | OSX 10.6.2 |
HTPC (XBMC) | 2.5GHz Core 2 Duo | GA-G31M-ES2L | 2GB RAM | 1.5TB | GeForce 9400 512MB | OSX 10.6.2 |
Reply With Quote
  (#2) Old
bmcclure937 bmcclure937 is offline
Super Moderator
bmcclure937's Avatar
Posts: 1,420
Join Date: Mar 2009
Location: United States
Send a message via AIM to bmcclure937
Default 10-08-2009, 02:52 PM

Nice info and neat terminal trick!!

 Mini 10v  | 2Gb RAM | 320 Gb HDD | Ubuntu 10.04 | OSX 10.6.3 | NBI .8.4RC1 | Chameleon Bullet Theme | BIOS A05 | USB Wake : OFF | USB Legacy : ON | No BlueTooth
Meklort's Blog | NBI Google Code Page | -- the best OSX installation guides
Reply With Quote
  (#3) Old
reflex reflex is offline
reflex's Avatar
Posts: 1,997
Join Date: Apr 2009
Default 10-08-2009, 05:52 PM

Good idea. I use similar commands in Linux. But I like the "du" (disk usage) command. "du" helps you find large directories, even if they're full of tiny files.

Anyways, "du -s -- * | sort -n | tail" gives you a list of the ten largest files/folders in the current directory. I use this one all the time. "du" and "tail" should both be present in OSX, too.

"find" is very useful for more sophisticated filtering. "find -mtime +30 -exec du -s -- {} \; | sort -nr | less" generates a list of files and directories, under the current directory, which haven't been modified in 30 days, sorted from biggest to smallest. Useful for finding files ready to be archived*.

* I'll admit that the "-atime" argument to find makes more sense than "-mtime", when looking for files which can be painlessly archived, but I usually disable file access time tracking for performance reasons.

Mini 9 | Intel 5100 Wifi | Ubuntu 10.04 Netbook
Mini 1012 | SSD | Intel 6200 Wifi | Ubuntu 11.10 64bit
Reply With Quote
  (#4) Old
grassle grassle is offline
Senior Member
Posts: 373
Join Date: May 2009
Default 10-08-2009, 06:04 PM

If you like point'n click, try Disk Inventory X and Tree Size.

Reply With Quote

« snow leopard with out a mac | HD Video on Mini 9 in OSX - Any good solutions? »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Copyright © 2008-2016