Find large files in current directory

alias big='BIG () { find . -size +${1}M -ls; }; BIG $1'
This is for bash - make an alias - also a good blueprint for making aliases that take arguments to functions. If for Solaris use "-size +${1}000000c" to replace "-size +${1}M"
Sample Output
$ big 100
1428749   524288 -rw-------    1 user staff    268435456 Mar  1 09:53 ./Desktop/centos-5.5-2.6.4/564d24cb-9632-8f69-724d-15622e3b68fc.vmem
1427799  2065664 -rw-r--r--    1 user staff    1057619968 Mar  9 22:30 ./Desktop/centos-5.5-2.6.4/CentOS-min-s001.vmdk
1427808  2334464 -rw-r--r--    1 user staff    1195245568 Mar  9 22:30 ./Desktop/centos-5.5-2.6.4/CentOS-min-s002.vmdk

By: greggster
2011-03-10 06:33:00

What Others Think

I don't understand why this is an alias. Why not just use a function? big(){ find . -size +${1}M -ls;} Also, you probably want to avoid putting $1 in an alias, because it doesn't do the same thing as in a function. Your "BIG $1" on the end will cause your alias to not function correctly if $1 is set in your shell. For example: set -- foo echo $1 foo big 100 find: Invalid argument `+fooM' to -size
eightmillion · 536 weeks and 4 days ago

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: