Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.
Hide

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:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

List the size (in human readable form) of all sub folders from the current location

Terminal - List the size (in human readable form) of all sub folders from the current location
du -h --max-depth=1
2009-02-05 14:37:24
User: PeekNPoke
Functions: du
132
List the size (in human readable form) of all sub folders from the current location

Alternatives

There are 6 alternatives - vote for the best!

Terminal - Alternatives
sudo du -ks $(ls -d */) | sort -nr | cut -f2 | xargs -d '\n' du -sh 2> /dev/null
2009-08-17 22:21:09
User: Code_Bleu
Functions: cut du ls sort sudo xargs
Tags: disk usage
7

This allows the output to be sorted from largest to smallest in human readable format.

du -sh */
du -sch ./*
du -a --max-depth=1 | sort -n
du --max-depth=1|sort -n|cut -f2|tr '\n' '\0'|xargs -0 du -sh 2>/dev/null

Know a better way?

If you can do better, submit your command here.

What others think

See also dutop:

http://www.pixelbeat.org/scripts/dutop

Comment by pixelbeat 408 weeks and 2 days ago

I actually use this command as an alias to simply "d" all the time. So helpful!

Comment by volve 408 weeks and 2 days ago

slightly different version: sizes of subfolders and files in the current folder

du -sh *
Comment by chickenkiller 408 weeks and 1 day ago

i was just about to post chickenkiller's method too

Comment by jlin64 406 weeks and 1 day ago

The difference between chicknkiller's method and PeekNPoke's method, is PeekNPoke's recurses hidden files and directories, while chickenkiller's does not.

Comment by atoponce 404 weeks and 5 days ago

I use this a lot when I'm tracing down to free up space

du -sh */

same as chickenkiller but only show directories

Comment by asmoore82 403 weeks and 5 days ago

On BSD you'd use

du -hd1
Comment by lme 402 weeks and 1 day ago

curses based: http://dev.yorhel.nl/ncdu/

Comment by Hollow 399 weeks and 4 days ago

Yes, this is very good one. I was always using

du -s *

but that, apparently is missing .* files

And I'm usually adding sort to du, to get better picture:

du -h --max-depth=1 | sort -n

Comment by vleolml 394 weeks and 5 days ago

You can't sort numbers followed by M K B try

du --max-depth=1 | sort -nr

n : sort by numbers

r : show big ones on the top :P

Comment by funyotros 369 weeks and 4 days ago

My du doesn't have a --maxdepth option.

Comment by putnamhill 364 weeks and 1 day ago

>>> You can't sort numbers followed by M K B try

But we can sort by this command:

du -h --max-depth=1 | sort -hr

-h: --human-numeric-sort compare human readable numbers (e.g., 2K 1G)

Comment by brun65i 318 weeks and 2 days ago

Now --max-depth has the short form -d, so --max-depth=N is the same as -d N

Comment by alfplayer 301 weeks ago

http://www.seattleseahawksjersey.us.com

http://www.uggcanada.com.co

http://www.uggbootscanada.ca

http://www.ugg-boots.fr

http://www.ugg-italia.it

http://www.michaelkorsoutlet-store.us.org

http://www.uggoutlet.eu.com

http://www.louis-vuittonoutlets.us.org

http://www.cheap-ugg-boots.com

http://www.true-religionoutlet.net.co

http://www.asicsshoes.name

http://www.christianlouboutinoutlet.com.co

http://www.cheaprolexwatches.name

http://www.louis-vuitton.name

http://www.montblanc-pens.name

http://www.outletmichaelkorsonline.us.com

http://www.michaelkors--outlet.us.org

http://www.designerhandbags.us.org

http://www.uggboots.gr.com

http://www.michaelkors--outlet.com

http://www.adidasshoes.net

http://www.uggssale.us.com

http://www.outlet-celine.com

http://www.polo-ralphlauren.cc

http://www.coach-factoryoutletsonline.us.com

http://www.uggbootsuk.in.net

http://www.louisvuittonofficial.us.com

http://www.raybansunglasses.uk

http://www.jordanretro.name

http://www.cheap--nfljerseys.us.com

http://www.hollisterclothing.net

http://www.louisvuittonhandbag.us.com

http://www.jordan4.net

http://www.uggbootsparis.fr

http://www.abercrombieandfitchoutlet.in.net

http://www.gucci-outlet.net.co

http://www.airmaxssale.com

http://www.montblancpen.us.com

http://www.uggmore.com

http://www.adidas-yeezy.us.com

http://www.timberlandboots.net.co

http://www.mbtshoes.us.com

http://www.cheapburberryoutlet.name

http://www.thenorthface.net.co

http://www.louboutinshoesoutlet.co.uk

http://www.cheapraybansunglasses.net.co

http://www.monclerjackets.com.co

http://www.burberryoutlet.in.net

http://www.moncleruk.in.net

http://www.raybanoutlet.net.co

http://www.ralphlaurenoutletuk.in.net

http://www.burberrysale.name

http://www.todsoutlet.in.net

http://www.ralphlaurenpolo.in.net

http://www.coachfactoryoutletclearances.us.com

http://www.uggsbootsstore.com

http://www.moncler--paris.fr

http://www.coachoutletstoreonlineclearances.us.com

http://www.pittsburghsteelersjerseys.us.com

http://www.uggbootscheap.com.co

http://www.uggsformen.in.net

http://www.ralph-lauren.me.uk

http://www.tomswedges.us

http://www.michaelkorsoutletforsale.com

http://www.supra-shoes.net

http://www.curry3.name

http://www.lebronjames-shoes.net

http://www.bostoncelticsjerseys.com

http://www.niketn-pascher.fr

http://uggs.uggaustralia.qc.com

http://www.coachfactoryoutletonlinesale.us.com

http://www.cheapjordansforsale.us

http://www.get-louisvuittonoutlet.com

http://www.nike-airmaxpascher.fr

http://www.rolexwatchesforsale.name

http://oakley.sunglassesonline.us.com

http://www.goldenstatewarriorsjerseys.us.com

http://www.redbottoms.org.uk

http://www.sunglassesoakley.com.co

http://www.uggs-pascher.fr

http://www.tomsshoes-outlet.com

http://www.uggsale.de.com

http://www.celine-outlet.us

http://www.truereligion-jeans.com.co

http://www.oakleysunglasses-outlet.com.co

http://www.lebronjames-shoes.name

http://www.coachclearance.us.com

http://www.michaelkorshandbagsonsale.com

http://www.gucci-outlet.name

http://www.montblanc.com.co

http://www.oakley-sunglasses.net.co

http://www.cincinnatibengalsjerseys.us.com

http://www.uggs.com.co

http://www.uggoutletforsale.in.net

http://www.ugguk.com.co

http://www.tiffanyandco.nom.co

http://www.fitflops.org

http://www.hogan-scarpe.it

http://www.uggsonsale.net.co

http://www.pandorajewelry.net.co

http://www.basketballshoes.name

http://www.canadagoose-pascher.fr

http://www.michaelkorsoutletoff.in.net

http://www.canadagoose.de.com

http://www.oakleysunglassescanada.ca

http://www.coachoutletstoreonlinesale.us.com

http://www.michaelkorsoutletstores.us.org

http://www.louisvuitton.me

http://www.adidastrainers.uk

http://www.instylercurlingiron.com

http://www.nhljerseys.org

http://www.ralphlauren-outlet.us.org

http://www.authenticlouisvuittonhandbags.us.com

http://www.rayban-sunglasses.com.co

http://www.pradaoutlet.net.co

http://www.minnesotavikingsjerseys.us.com

http://www.adidasnmd-shoes.us.com

http://www.insanityworkout.cc

http://www.michaelkorsuk.com.co

http://www.louisvuittonlvoutlet.us.com

http://www.uggcanada.in.net

http://www.uggoutlet.qc.com

http://www.tiffanyandcojewelry.com.co

http://www.adidasoutletshoes.com

http://www.uggboots4sale.com

http://www.oakleysunglassess.com.co

http://www.louisvuittonoutletdeals.us.com

http://www.tomssale.in.net

http://www.uggoutlet.gr.com

http://www.adidasyeezy350.us.com

http://www.uggslippers.de.com

http://www.fitflops.us.com

http://www.newyorkknicksjerseys.us.com

http://www.longchamp.us.com

http://www.gucci-outlet.org

http://www.clevelandcavaliersjerseys.us.com

http://www.nike-rosherun.in.net

http://www.true-religion.me.uk

http://www.uggsforwomen.in.net

http://www.replicawatches.name

http://www.tomsshoesuk.org.uk

http://www.washingtonwizardsjerseys.com

http://www.christianlouboutin.name

http://www.nikeoutletstores.us.com

http://www.louisvuitton.nom.co

http://www.louisvuittonhanbags.co.uk

http://www.katespadehandbagsoutlet.us.com

http://www.raybanpascher.fr

http://www.louisvuittonoutlet.de.com

http://www.michaelkorsoutletstoreonline.com

http://www.vansshoes.name

http://www.adidassuperstar.name

http://www.christianlouboutin-paris.fr

http://www.fitflopssaleclearance.us.org

http://www.louisvuittonoutlet.co

http://www.louisvuittonoutletsale.us.com

http://www.uggsuk.in.net

http://www.cheapjordansshoes.us.com

http://www.rosherun.org

http://www.newcanadagooseoutlet.com

http://www.newenglandpatriotsjerseys.us.com

http://www.oklahomacitythunderjerseys.us.com

http://www.louis-vuittonhandbags.com.co

http://www.canadagooseoutletsale.com.co

http://www.canadagoose.com.co

http://www.aididasyeezy.org.uk

http://www.coachoutletstoreonlineclearances.us.org

http://www.nike--rosherun.fr

http://timberlandboots.hugeoff.net

http://www.uggsoutlet.eu.com

http://www.juicy-couture.us

http://www.jordan13.org

http://www.ralphlaurenoutletonline.in.net

http://www.christianlouboutinoutlet.com

http://www.gucci.me.uk

http://www.raybansonsale.com.co

http://www.losangelesclippersjerseys.com

http://www.raybansunglasses.me.uk

http://www.louboutinfemme-pascher.fr

http://www.coachcanadaoutlet.com.co

http://www.uggoutlet.de.com

http://www.raybansunglassesoutlet.net.co

http://www.canada-gooseoutlet.name

http://www.rolexwatches.us.com

http://www.uggsoutlet.de.com

http://www.cheappandorajewelry.name

http://www.longchamp-sac.fr

http://www.officialcoachfactoryonlinesale.us.com

http://www.hermesbagusa.com

http://www.louboutinshoes.cc

http://www.pradahandbags.net

http://www.cheaprolexforsale.com

http://www.louisvuittonoutletstores.us

http://www.coachoutletsale.us.com

http://www.truereligionjeans-outlet.us.com

http://www.adidasoriginals.in.net

http://www.coach-bags.us.com

http://www.chicagobullsjerseys.com

http://www.monclerpascherhomme.fr

http://www.kevindurantshoes.name

http://www.louis-vuitton-borse.it

http://www.louisvuittonoutlet.net.co

http://www.louisvuittoncanada.com.co

http://www.michaelkors--outlet.com.co

http://www.burberry-outlet.com.co

http://www.mlbjerseys.org

http://www.uggsale.net.co

http://www.toms-shoes.cc

http://www.toms.us.org

http://www.uggbootssale.de.com

http://www.ralphlauren-outlet.net.co

http://www.louboutinshoessale.com

http://www.hollister-clothing.org

http://www.dallasmavericksjerseys.com

http://www.uggsforcheap.in.net

http://www.uggsaustralia.it

http://www.ralphlaurenclearance.in.net

http://www.louisvuitton-handbags.com.co

http://www.nfljerseyswholesales.us

http://www.uggsoutlet.gr.com

http://www.toryburch-outlet.in.net

http://www.jordan6.net

http://www.kobebryantshoes.name

http://www.tommyhilfigeroutlet.us.org

http://www.uggbootsuk.com.co

http://www.oakleys-sunglasses.us.org

http://www.nba-jerseys.us.com

http://www.cheapjordansshoes.in.net

http://www.adidas-nmd.co.uk

http://www.clarisonic.com.co

http://www.michaelkorsoutlet-onlinestore.us.com

http://www.cheapuggs.de.com

http://www.uggsonsale.de.com

http://www.north-faceoutlet.net.co

http://www.raybansunglassess.com.co

http://www.katespade.eu.com

http://www.louis-vuittonoutlet.com.co

http://www.sanantoniospursjerseys.us.com

http://www.gucci--outlet.com.co

http://www.miamiheatjerseys.us.com

http://www.coachfactoryoutlet-onlinestore.us.com

http://www.uggssale.com.co

http://www.true-religionjeans.in.net

http://www.adidasoutletstore.net

http://www.fitflopsuk.me.uk

http://www.coachfactory-outlet.in.net

http://www.uggslippers.com.co

http://www.themichaelkorsoutlet.com

http://www.cheapoakleysunglassess.com.co

http://www.officialmichaelkorsoutlet.us.com

http://www.katespadeoutlets.us.com

http://www.denverbroncosjerseys.us.com

http://www.retrojordans.name

http://www.jordanfemmepascher.fr

http://www.cheapraybans.us.org

http://www.coachoutletsaleonline.us.com

http://www.michaelkorsoutlet--online.com

http://www.michael-korsbags.us.com

http://www.jordan8.net

http://www.canadagooseoutlets.com.co

http://www.christianlouboutin-pas-cher.fr

http://www.outletsmichaelkors.us.com

http://www.canada-gooseoutlet.net.co

http://timberland.officialfree.net

http://www.uggssale.de.com

http://www.beatsbydrdresolo.us

http://www.cheapoakleysunglasses.net.co

http://www.ghdhairstraighteners.com.co

http://www.oakleyvaultoutlet.in.net

http://www.michaelkorsoutletcanada.com.co

http://www.cheap-jordans.us.com

http://www.kobeshoes.org

http://www.canadagooseuk.com.co

http://www.coachfactoryoutlet-online.eu.com

http://www.louis-vuittonoutlet.us.com

http://www.michael-korsoutlets.eu.com

http://www.canadagoosejackets.com.co

http://www.christianlouboutinsale.me.uk

http://www.louisvuitton-discount.com

http://www.outletmichaelkorshandbags.us.com

http://www.nikeoutletstore.us.com

http://www.christianlouboutinoff.us

http://www.ray-ban-sunglasses.com.co

http://www.rolexwatchesoutlet.us

http://www.pandorajewelry.name

http://www.nike-airmax.me.uk

http://www.jordanshoes.us.org

http://www.seattleseahawksjerseys.us.com

http://www.michaelkorsoutletclearance.us.org

http://www.louisvuittonparis.fr

http://www.uggbootsuk.eu.com

http://www.michaelkorsoutletonline.us.org

http://www.louisvuitton.de.com

http://www.jordan3.net

http://www.abercrombieoutletonline.cc

http://www.coachoutletonlinesale.com

http://www.edhardyclothing.in.net

http://ugg.uggsstore.eu

http://www.raybanssunglasses.com.co

http://www.truereligion-jeans.us

http://www.louisvuittonhandbags.net.co

http://www.airjordan-pascher.fr

http://www.jordansforsale.in.net

http://www.jordanconcords.net

http://www.oakleystore.com.co

http://www.canadagooseoutlet.eu.com

http://www.officialcoachfactoryoutlet.com.co

http://www.chanelbags.in.net

http://www.niketrainers.uk

http://www.louisvuitton-outlet.cc

201610.27wengdongdong

Comment by wengdongdong7 5 weeks and 3 days ago

Your point of view

You must be signed in to comment.