Recursively find top 20 largest files (> 1MB) sort human readable format

find . -type f -print0 | xargs -0 du -h | sort -hr | head -20
Search for files and list the 20 largest. find . -type f gives us a list of file, recursively, starting from here (.) -print0 | xargs -0 du -h separate the names of files with NULL characters, so we're not confused by spaces then xargs run the du command to find their size (in human-readable form -- 64M not 64123456) | sort -hr use sort to arrange the list in size order. sort -h knows that 1M is bigger than 9K | head -20 finally only select the top twenty out of the list
Sample Output
64M	./icons/gnome/icon-theme.cache
23M	./fonts/extra-fonts/arialuni.ttf
22M	./libpinyin/data/bigram.db
21M	./fonts/cjkuni-uming/uming.ttc
20M	./anthy/anthy.dic
18M	./mythes/th_en_US_v2.dat
17M	./fonts/wqy-zenhei/wqy-zenhei.ttc
14M	./icons/hicolor/icon-theme.cache
14M	./icons/Faenza/icon-theme.cache
8.3M	./cracklib/pw_dict.pwd
6.2M	./mm-common/doctags/libstdc++.tag
6.2M	./libhangul/hanja/hanja.txt
5.4M	./icons/Mist/icon-theme.cache
4.8M	./gir-1.0/Gtk-3.0.gir
4.8M	./dict/linux.words
4.4M	./gir-1.0/Gtk-2.0.gir
4.3M	./anthy/zipcode.t
4.0M	./fonts/un-core/UnDotumBold.ttf
3.9M	./opencc/simp_to_trad_phrases.ocd
3.8M	./tor/geoip

11
By: flatcap
2012-03-30 10:21:12

1 Alternatives + Submit Alt

What Others Think

Too new for my system :o sort -hr sort: invalid option -- 'h' Try `sort --help' for more information.
bashrc · 557 weeks and 3 days ago
@bashrc: Really? Sorry, it's been in Gnu sort since 2009 (v7.5).
flatcap · 557 weeks and 2 days ago
@flatcap: On RedHat/CentOS 5 this doesn't work.
Doskias · 340 weeks and 4 days ago
Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 5 weeks and 2 days ago
Manchester City will host Brentford at the Etihad Stadium in Week 16 of the 2022/2023 Premier League. This Premier League match ended bitterly for City. They lost to the guest with a score of 1-2. Ivan Toney put Brentford ahead in the 16th minute, then Phil Foden equalized for City in the 45+5 minutes. City were forced to bite their fingers after Ivan Toney scored the second goal for Brentford in this match in the 90+8 minute. City still has 32 points in second place. If standings leader Arsenal (34 points) later wins over host Wolverhampton, then the point difference between them will be five. This is the last Premier League match before the 2022 World Cup break. Clubs will compete again starting in December 2022. Manchester City Falls at Home Brentford surprisingly took the initiative to attack. After several times pounding City's back line in the early minutes, Brentford was even able to steal the first goal. Ivan Toney, who was recently left out of England's squad for the 2022 World Cup, fired Brentford ahead at the reigning champions with a header. City, of course, did not remain silent. However, City could only equalize at the end of the first half. Starting from Kevin De Bruyne's corner, which first hit Manuel Akanji's head, Foden equalized the score with his left foot. black panther wakanda forever streaming vf one piece red pelicula completa ".' Premier League Premier League After a draw in the first half, the match went tough in the second half. Citu dominated and created more chances, but their finishing was not optimal. Erling Haaland performed well below his best standards. Throughout the match, the Premier League's temporary top scorer was recorded as only releasing one shot, and that too was off target. City actually get disastrous in injury time. From Josh Dasilva's assist, Brentford scored the second goal as well as the decisive goal. That goal was scored by the same player who scored the opener, Ivan Toney. Ivan Toney's brace also made The Citizens fall at the Etihad Stadium. Starting XI and Match Statistics Manchester City (4-3-3): Ederson; John Stones, Manuel Akanji, Aymeric Laporte, Joao Cancelo; Kevin De Bruyne, Rodri, Ilkay Gundogan; Phil Foden, Erling Haaland, Bernardo Silva. Coach: Josep Guardiola. Brentford (3-5-2): David Raya; Zanka, Ben Mee, Ethan Pinnock; Mads Roerslev, Frank Onyeka, Vitaly Janelt, Mathias Jensen, Rico Henry; Bryan Mbeumo, Ivan Toney.
masdani233 · 3 weeks and 2 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: