for a particular file system, find all files > 10MBytes, sorted by size

cd <mntpoint>; find . -xdev -size +10000000c -exec ls -l {} \; | sort -n -k 5
This is a quick way to find what is hogging disk space when you get a full disk alert on your monitoring system. This won't work as is with filesystems that allow embedded spaces in user names or groups (read "Mac OS X attached to a Windows Domain"). In those cases, you will need to change the -k 5 to something that works in your situation.
Sample Output
[[email protected] ~]$ find . -xdev -size +10000000c -exec ls -l {} \; | sort -n -k 5
-rw-rw-r-- 1 dritchie platform 10067603 Apr 26 23:09 ./bin/valid.out
-rw-rw-r-- 1 dritchie platform 13669316 Apr 26 23:09 ./repack/hd/hd_files.txt
-rw-rw-r-- 1 dritchie platform 17220128 Apr 26 23:09 ./fsmedlist.strace.out
-rw-rw-r-- 1 dritchie platform 29587970 Apr 26 23:09 ./snapi_RedHat60AS_26x86_64_2.0.3_25257.bin
-rw-rw-r-- 1 dritchie platform 49060805 Apr 26 23:09 ./bin/updatestatus
[[email protected] ~]$ 

By: deritchie
2014-05-20 14:13:54

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: