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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.
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

Add Rudimentary Logging Levels According to STDOUT/STDERR

Terminal - Add Rudimentary Logging Levels According to STDOUT/STDERR
[command] 2> >(fb=$(dd bs=1 count=1 2>/dev/null | od -t o1 -A n); [ "$fb" ] && err=$(printf "\\${fb# }"; cat) && echo "ERROR - $err")
2017-10-16 22:22:42
User: tyzbit
Functions: dd echo od printf
0
Add Rudimentary Logging Levels According to STDOUT/STDERR

This is a bit of a bash hack to catch STDERR and append a log level to it.

So for example, if your script has pseudo loglevels like so:

echo "INFO - finding files"

[ -f ${files} ] || echo "WARN - no files found"

Any subcommands that write to STDERR will screw that up

Adding 2> >(fb=$(dd bs=1 count=1 2>/dev/null | od -t o1 -A n); [ "$fb" ] && err=$(printf "\\${fb# }"; cat) && echo "ERROR - $err") to the command does the following:

2>

Redirect STDERR

>(

Spawn a subshell (STDERR is then redirected to the file descriptor for this subshell)

fb=$(....)

get the first byte of input

[ "$fb" ]

test if there's a first byte

&& err=$(printf....)

save the output to the $err variable

&& echo "ERROR - $err"

append your pseudo loglevel and the error message

Heavily borrowed from https://unix.stackexchange.com/questions/33049/check-if-pipe-is-empty-and-run-a-command-on-the-data-if-it-isnt

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

Visit Doracheats.com!

Comment by kannuk5 4 weeks and 5 days ago

http://www.doracheats.com

Comment by kannuk5 4 weeks and 5 days ago

Visit Doracheats.com!

Comment by kannuk5 4 weeks and 5 days ago
Comment by A1V2A3 4 weeks and 1 day ago

i am also very very love it,I am Amos.z from The forefront of absolute fashion trends, exclusive news presentation! If you want to know more, please continue to pay attention to @http://www.bootsshoppingonline.com and turn on those alerts for more updates on this release. Otherwise, take a look at listed retailers/ raffles below and good luck on the morning of release.

Web:www.bootsshoppingonline.com

WhatsApp:+8617081681935

Email:[email protected]

https://www.facebook.com/maike.li.547

er

Comment by maikefa 2 weeks and 5 days ago

Great posts, I am a student and take classes of android. I have also many problems and I am searching the answer of these problems but I didn't got the proper answer Black Friday Promo Codes .I am glad that you are providing such a great platform where I can discuss my issues regarding coding. Thanks for the good post, keep posting.

Comment by jenifervanquez 6 days ago

http://www.michaelkorsoutletonlinemichaelkors.us.com

http://www.pandoracharmssaleclearance.uk

http://www.canadagoosesaleoutlet.us.com

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

http://www.cheapjordanshoes.us.com

http://www.ralphlaurenoutlet-polo.us.com

http://www.hermesbirkin.in.net

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

http://www.michaelkorsoutlet1.us.com

http://www.cheapoakleysunglasses.com.co

http://www.michaelkorsoutlets.us.com

http://www.coachoutletsonlines.us.com

http://www.uggcanadaboots.ca

http://www.cheapmlbjerseys.us

http://www.canadagooseoutletstores.us

http://www.cheapraybansunglassessale.us.com

http://www.canadagooseoutlet.cc

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

http://www.coachhandbagsoutlet.us.com

http://www.uggsboots.name

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

http://www.burberryoutletsale.com.co

http://www.ralphlaurenoutletpolo.org.uk

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

http://www.burberry-outlet-canada.ca

http://www.supremenewyork.us.com

http://www.louboutinshoes.in.net

http://www.coachfactory-outletstore.us.com

http://www.louisvuitton-outletonline.us.com

http://www.outletlouisvuitton.us.com

http://www.coachoutlets.us.org

http://www.coachoutletstoreonline.com.co

http://www.canadagoose-outlet.name

http://www.cheapjordans.in.net

http://www.pandorajewelryoutlet.in.net

http://www.adidasyeezyshoes.us.com

http://www.canadagoosejackets-outlet.us

http://www.toryburchoutletonline.com.co

http://www.kate-spade.us.com

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

http://www.vuittonlouis.us.com

http://www.uggbootsclearance.com.co

http://www.adidasnmd-shoes.us

http://www.nikeairmax.in.net

http://www.uggbootsclearance.org.uk

http://www.uggsoutletonlines.us.com

http://www.coach-factoryoutlet-online.us.com

http://www.fredperrypoloshirts.us

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

http://www.uggsaustraliaoutlet.us.com

http://www.timberlandbootsoutlets.us.com

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

http://www.cheapuggssale.com.co

http://www.ugg-uk.org.uk

http://www.ralph-laurenoutlet.org.uk

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

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

http://www.airjordanshoes.in.net

http://www.adidasnmd.us.org

http://www.timberland-outlets.us

http://www.mulberryoutlet.org.uk

http://www.yeezyboost-350.co.uk

http://www.uggs.net.co

http://www.outletcoachoutlet.us.com

http://www.cheapjordans.com.co

http://www.hermes.us.org

http://www.fitflopssale.us.com

http://www.canadagoosesalejackets.us.com

http://www.coach-factory-outlet.us.org

http://www.northface-jackets.us.com

http://www.pandora-charms.us.org

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

http://www.uggaustraliaoutlet.in.net

http://www.ralphlaurensaleclearance.org.uk

http://www.uggoutlet-clearance.us.com

http://www.thenorthface.us.com

http://www.uggoutlets.name

http://www.katespadehandbagsclearance.us.com

http://www.ralph-laurenuk.org.uk

http://www.burberry.us.com

http://www.ralphlaurensaleclearance.me.uk

http://www.uggsonsale.us.com

http://www.nike-store.us.com

http://www.jacketscanadagoose.com.co

http://www.cheapoakleysunglassesofficial.us.com

http://www.ugg.net.co

http://www.cheapraybans.com.co

http://www.harden-vol1.com

http://www.toryburchoutletonlines.us.com

http://www.polooutlet.in.net

http://www.yeezyboost-350.us.com

http://www.coachoutletonlinecoachfactoryoutlet.us.com

http://www.mbtshoes.name

http://www.polooutlets.us.org

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

http://www.ralphlaurenoutlet.us.org

http://www.pandora.us.com

http://www.columbiasportswear.us.com

http://www.canadagoosesoutlet.ca

http://www.korsmichaeloutlet.us.com

http://www.uggs-outlets.com.co

http://www.uggbootsoutletstores.us.com

http://www.uggsaustralia.fr

http://www.birkenstocks.us

http://www.canadagoose-jacketsoutlet.us

http://www.louisvuittonoutlet.us.org

http://www.uggsoutlets.name

http://www.uggsbootsonline.us.com

http://ugg.bootsoutlet.us.com

http://www.michaelkorsfactoryoutletsale.us.com

http://www.uggs-clearance.us.com

http://www.canadagoosejacketscanada.com.co

http://www.pandoracharms.us.com

http://www.ugg-outletstores.us.com

http://www.coachoutletstoreonlineclearances.in.net

http://www.canadagoosejacketsoutlet.name

http://www.jordanretro.name

http://www.hermesbag.us.com

http://www.northfacejacketsoutlet.com.co

http://www.canadagoosejacketscoats.org.uk

http://www.nfljerseyscheapwholesale.us.com

http://www.canadagooseoutletonlines.us

http://www.coachoutletcanada.ca

http://www.ralphlaurenoutletonline-polo.us.com

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

http://www.northfacejacketssale.us.com

http://www.moncleroutletonlines.us.com

http://www.supremeclothing.us.org

http://www.nikeoutletonline.us.com

http://www.outletcanadagoose.us

http://www.monclerjacketssale.us.com

http://www.coachfactoryoutletsonlines.us.com

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

http://www.uggoutlet-onlines.us.com

http://www.coachoutlet-onlinesale.us.com

http://www.salvatoreferragamoshoes.us.com

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

http://www.longchampoutletus.us.com

http://www.adidasshoe.us.com

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

http://www.jacketscanadagoose.org.uk

http://www.canadiangoose.us.com

http://www.cheapuggs.net.co

http://www.canadagooseoutletjackets.com.co

http://www.uggsoutletstoreonline.us.com

http://www.coach-outletonline.us.org

http://www.uggs-boots.fr

http://www.moncleroutlet.me.uk

http://www.ralphlaurenoutlet.in.net

http://www.canadagooseoutletjackets.ca

http://www.cheapjordan-shoes.in.net

http://www.michaelkorsoutlet.co.uk

http://www.ralphlaurenoutletsale.us.com

http://www.supremeclothing.org.uk

http://www.cheapmlbjerseyschina.us.com

http://www.cheapuggs.com.co

http://www.outletcoachonline.us.com

http://www.ralphlauren.me.uk

http://www.yeezyboost.org.uk

http://www.pandora-jewelryoutlet.us.com

http://www.poloralphlaurenoutletonline.us.com

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

http://www.hermes-handbags.us

http://www.coachoutletmalls.us.com

http://www.mbtshoes.us.org

http://www.thenorthfacejacketsoutlet.us.com

http://www.canadagooseclothing.us.com

http://www.longchamphandbagsuk.org.uk

http://www.pandoracharms.com.co

http://www.nikeshoes.us.com

http://www.nikeoutlet.us.com

http://www.doudounemonclerpascher.fr

http://www.christianlouboutinoutlet.us

http://www.outletmichaelkorsonline.us.com

http://www.uggs-boots.us

http://www.michael-korsoutlet.ca

http://www.uggsoutletclearance.us.com

http://www.ralphlaurenuk.me.uk

http://www.nikeshoes.in.net

http://wwwcanadagoose-uk.com.co

http://www.valentinoshoesoutlets.us.com

http://www.catboots.us

http://www.uggsbootscanada.ca

http://www.oakley.nom.co

http://www.cheapuggboots.us.com

http://www.uggaustraliaoutlet.com.co

http://www.canadagooseoutlet-jackets.us

http://www.ugg-boots.org.uk

http://www.uggoutletstore.name

http://www.uggsoutlet.cc

http://www.adidasoutlet.us.com

http://www.canadagooseoutletjackets.us

http://www.uggbootsoutletsale.us.com

http://www.coach-factoryoutletonline.us.org

http://www.uggbootssales.us.com

http://www.uggs--canada.ca

http://www.coachfactoryonlineoutlet.com.co

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

http://www.airmax-2018.com

http://www.katespade.in.net

http://www.canadagooseoutletjackets.us.com

http://www.cheapnfljerseysofficial.us.com

http://www.polo-ralphlauren.in.net

http://www.uggshoes.us.com

http://www.canadagoosejacket.com.co

http://www.ralphlauren-outletpolo.us.com

http://www.outletcanadagooseoutlet.us.com

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

http://www.monclerjacketsoutlet.in.net

http://www.airjordans.us.com

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

http://www.christianlouboutinshoes.us.org

http://www.canadagooseoutlets.us

http://www.tomsoutlets.us.com

http://www.cheapuggs-boots.us.com

http://www.nikeoutlet.in.net

http://www.coachoutlet-online.us.org

http://www.michaelkorsoutletonlineclearance.in.net

http://www.moncleroutlets.us.org

http://www.uggs-australia.it

http://www.northfaceoutlet.us.com

http://www.canadagooseoutlet.name

http://www.uggoutlets.us.org

http://www.uggoutlet-store.us

http://www.red-bottoms.us.com

http://www.canadagoosejacketscanada.ca

http://www.mlbjerseyscheap.us.com

http://www.katespadeonlineoutlet.us.com

http://www.guccioutlets.us.org

http://www.pandoracharms.name

http://www.uggbootsonline.us

http://www.canadagooseoutletcanada.com.co

http://wwwcanadagoose-jacketsuk.com.co

http://www.canadagooseoutletus.us.com

http://www.raybansunglasses.net.co

http://www.2017nikeairmax.us

http://www.coachcanadaoutlet.ca

http://www.moncler-outlets.us.com

http://www.canadagooseukjackets.org.uk

http://www.coachfactory-outletonline.us.org

http://www.redbottomsshoes.us.com

http://www.guccihandbagsoutlet.us.com

http://www.canadagooseukjackets.me.uk

http://www.uggoutletonline.name

http://www.ralph-laurenoutlet.com.co

http://www.ugg-boots.net.co

http://www.michaelkorsoutletshopping.us.com

http://www.michael-korshandbags.me.uk

http://www.coachoutletus.us.com

http://www.uggoutlets.in.net

http://www.pandora-uk.me.uk

http://www.mulberry-bags.me.uk

http://www.pandoracharms-uk.org.uk

http://www.canadagoosejacketssale.com.co

http://www.cheapjerseyswholesalefromchina.us.com

http://wwwmonclerjacketsuk.com.co

http://www.uggoutlet.cc

http://www.raybanssunglassesoutlet.us.com

http://www.michaelkorsoutletclearance.in.net

http://www.ugg-outlets.us

http://www.burberryoutlet.in.net

http://www.monclerjacketsuk.org.uk

http://www.uggsoutlets.us.org

http://www.yeezyboost.us.com

http://www.uggoutletonlines.us

http://www.adadassuperstar.com

http://www.ultraboost.us

http://www.uggs-boots.us.org

http://www.michaelkors-outlet.ca

Comment by 20171122yuanyuan 23 hours ago

Your point of view

You must be signed in to comment.