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

Use ping to test if a server is up

Terminal - Use ping to test if a server is up
if [ "$(ping -q -c1 google.com)" ];then wget -mnd -q http://www.google.com/intl/en_ALL/images/logo.gif ;fi
2010-03-23 04:15:03
User: alf
Functions: wget
-1
Use ping to test if a server is up

Bash scrip to test if a server is up, you can use this before wget'ing a file to make sure a blank one isn't downloaded.

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

If you're not going to have an "else" clause, you can shorten that to:

[ "$(ping -q -c1 google.com)" ] && wget ...

'if' works by using the '[' (test) command, but you can use it directly.

Comment by flatcap 356 weeks and 2 days ago

Alternatively (not as pretty):

ping -c1 google.com > /dev/null && wget ...
Comment by flatcap 356 weeks and 2 days ago

Wouldn't it be better to use curl -I to check the headers for a 200 OK? Just because a machine is responding to pings, that doesn't mean that the webserver is up.

Comment by eightmillion 356 weeks and 2 days ago

I don't have the means to test this example at the moment, but I believe it should work.

curl -Is google.com 2>&1 | grep -q "200 OK" && wget ...
Comment by eightmillion 356 weeks and 2 days ago

Great alternatives, I'll have to give these a try!

Comment by alf 356 weeks and 2 days ago

'if' expects a command. '[' is actually a program, not part of the shell. So you can actually just do

if ping -q -c1 google.com; then ...
Comment by recursiverse 356 weeks and 1 day ago

No need for the 'then' or even an 'else', just use && or ||

e.g.:

ping -c1 host.com > /dev/null && echo "YES" || echo "NO"

This is the equivalent of:

if ping -c1 host .com > /dev/null then echo "YES" else echo "NO" fi
Comment by finkployd 328 weeks and 1 day ago

2016-1-26 xiaozhengm

http://www.coachfactory--outletonline.com

http://www.fitflopuk.me.uk

http://www.michaelkorsukbag.co.uk

http://www.get-coachoutletonline.org

http://www.michaelkors-handbag.me.uk

http://www.runningshoes.com.co

http://www.toms-outlet.cc

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

http://www.louboutinshoes.cc

http://canadagoose.outletmalls.us.com

http://www.nike-blazerlow.fr

http://uggs.uggaustralia.qc.com

http://www.nikestoreuk.me.uk

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

http://coach.outletmalls.us.com

http://www.adidasshoes.name

http://michaelkors.adsmall.us.com

http://www.hermesbelt.in.net

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

http://coach.eshopping.us.com

http://louisvuitton.outletmalls.us.com

http://www.hermesuk.org.uk

http://www.katespadeoutletsale.in.net

http://toms.adsmall.us.com

http://www.fitflopssaleclearance.com

http://michaelkors.eshopping.us.com

http://ugg.adsmall.us.com

http://www.louis-vuitton-outlet.us.com

http://www.canadagoosejackets.org.uk

http://ugg.eshopping.us.com

http://www.timberlanduk.me.uk

http://www.jordan13.org

http://christianlouboutin.outletmalls.us.com

http://www.coachoutlet-storeonline.in.net

http://www.instylermax.in.net

http://www.coachfactoryoutletus.in.net

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

http://tiffany.outletmalls.us.com

http://www.louboutin.org.uk

http://www.monclerjacketsoutlet.us.com

http://louboutin.adsmall.us.com

http://www.louisvuitton-borse.it

http://www.mcmhandbags.name

http://www.truereligion-outlet.com

http://www.new-balanceoutlet.us

http://www.louisvuitton-sac-pascher.fr

http://www.outlet-toms.cc

http://canadagoose.shopgioia.com

http://www.coach-factory-outlet-online.us.com

http://www.top-coachoutletstore.org

http://www.edhardy-outlet.name

http://www.jordan6.net

http://www.longchamphandbags.com.co

http://www.chaussurelouboutin-pascher.fr

http://www.ghdstraighteners.me.uk

http://www.nike-tn-pascher.fr

http://www.saclongchamp-solde.fr

http://www.coachcanadaoutlet.ca

http://burberryoutlet.outletmalls.us.com

http://sunglasses.outletmalls.us.com

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

http://www.nikefreeruns.uk

http://michaelkors.outletmalls.us.com

http://www.mk-michaelkorsoutletonline.com

http://www.cheaplouisvuittonhandbags.org

http://burberry.eshopping.us.com

http://www.michaelkors-outletonlines.in.net

http://www.airjordan-pascher.fr

http://www.ralphlaurenuk.me.uk

http://www.moncler-jackets.org

http://www.adidassuperstar.co.uk

http://abercrombie.shopgioia.com

http://www.authenticlouisvuittonhandbags.net

http://www.airforce1-nike.fr

http://www.coach-factoryoutlet.cc

http://www.coachoutletonlinespick.org

http://www.coachouletbtf.com

http://rayban.eshopping.us.com

http://www.ghdhairstraighteners.com.co

http://www.ralph-lauren-pas-cher.fr

http://ralphlauren.shopgioia.com

http://rayban.adsmall.us.com

http://www.mcmoutlet.us

http://www.louisvuittonuk.me.uk

http://www.jordan-femmepascher.fr

http://www.toms.in.net

http://burberry.outletmalls.us.com

http://www.cheap-uggsonsale.in.net

http://oakley.adsmall.us.com

http://www.basketballshoes.net.co

http://ugg.shopgioia.com

http://www.raybansoutlet.in.net

http://www.mizunorunningshoes.in.net

http://www.pandoracharms.com.co

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

http://www.michaelkorsoutletoff.in.net

http://www.tomswedges.in.net

http://ugg.outletmalls.us.com

http://www.cheapjordansshoes.in.net

http://www.mymichaelkorssoutlets.org

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

http://www.michaelkors-handbags.me.uk

http://www.nikeblazers.me.uk

http://burberry.shopgioia.com

http://timberland.adsmall.us.com

http://coach.adsmall.us.com

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

http://www.nikesb.uk

http://www.nikerosherunwomen.me.uk

http://www.christianlouboutinuk.me.uk

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

http://www.adidas-trainers.me.uk

http://www.michaelkors-discount.com

http://www.polooutlet.us.com

http://www.niketrainers.com.co

http://www.airmax95.org.uk

http://www.montblancpens.us.org

http://www.adidasuk.org.uk

http://www.poloralphlauren.net.co

http://www.rolex-replicawatches.com.co

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

http://www.jordan3.net

http://www.cheapwholesaleuggboots.com

http://hollister.shopgioia.com

http://www.michaelkorshandbags.cc

http://www.fitflops.in.net

http://www.snapbacks-wholesale.us

http://www.edhardyukclothing.me.uk

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

http://www.fitflops.us

http://www.raybans.org.uk

http://northface.outletmalls.us.com

http://nike.outletmalls.us.com

http://www.michaelkorsoutletforus.com

http://www.toryburchoutlet-sale.in.net

http://www.juicy-couture.us

http://www.raybansunglassesdeals.com.co

http://www.louis-vuittonhandbags.us

http://www.quality-outlet.com

http://christianlouboutin.eshopping.us.com

http://www.cheap-tomsoutlet.us

http://www.longchampoutlet.net.co

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

http://www.louisvuittonoutlets.name

http://www.coach-factoryoutlet.eu.com

http://www.tomsshoes.us.com

http://www.canadagooseoutlet.cc

http://canadagoose.adsmall.us.com

http://www.adidasgazelle.me.uk

http://christianlouboutin.shopgioia.com

http://www.kate-spadeoutlet.com.co

http://www.pradaoutlet.name

http://www.guccioutlet.com.so

http://www.jordan4.net

http://canadagoose.eshopping.us.com

http://www.michael-korshandbags.net.co

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

http://www.nikerosheruns.me.uk

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

http://oakley.shopgioia.com

http://www.sunglass-outlet.us

http://www.chiflatiron.in.net

http://www.tomsoutletstore.in.net

http://www.coachoutletstoreonlines.us

http://www.gucci-borse.it

http://www.jordan8.net

http://www.michaelkors-mkoutlet.in.net

http://www.chaussure-louboutin.fr

http://www.michaelkors-outletsale.com

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

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

http://burberry.adsmall.us.com

http://www.montblanc-pens.name

http://www.sac-longchamppliage.fr

http://www.saclongchamp--pascher.fr

http://www.michaelkorsoutletvip.in.net

http://www.cheapjordans.com.co

http://www.louisvuitton-outletstores.org

http://www.marc-jacobs.in.net

http://www.pandorajewelryoutlet.name

http://www.christianlouboutinsell.net

http://www.michael-kors-handbags.uk

http://rayban.shopgioia.com

http://www.oakleysunglassesfake.in.net

http://www.kate-spadeoutlet.us

http://www.coach-factoryoutlet.com.co

http://www.gucci-outlet.org

http://www.adidas-shoes.me.uk

http://ralphlauren.eshopping.us.com

http://oakley.eshopping.us.com

http://www.vipmichaelkors-outletonline.com

http://www.canadagooseuk.me.uk

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

http://www.kate-spadeoutlet.in.net

http://truereligion.adsmall.us.com

http://jordan.outletmalls.us.com

http://www.guccioutlet.net.co

http://www.nikeuk.me.uk

http://www.katespadeuk.me.uk

http://www.christianlouboutinoff.us

http://www.nikecortez.com.co

http://www.nikehuarache.com.co

Comment by xiaozhengm 51 weeks and 3 days ago

Different sorts involving service bags, if a solution regarding plastic, newspaper or maybe jute, should have several impact on the planet earth throughout the building process, travel and excessive exchange. Ideal approach to decrease their particular co2 ft . fashioned impact is to essentially re-utilize these on the other hand frequently as might realistically need and also afterword reuse these people on the complete of the purposeful existence.Plastic service provider bagsWhile plastic service provider bags employ 70% less cheap compared to do 19 years earlier, they are even now developed outside of polyethylene (Premature ejaculation) that's deduced by non-renewable gas and wish stamina to create.Plastic bags are usually eco friendly and they are a growing number of being reprocessed, although the lion's write about nevertheless will be found in landfill exactly where they could appreciate countless many years to liberation lower. Increasing your reused chemical of recent plastic bags strategy for making use of fewer trait resources along with decreasing natural effect of provides.Degradable Delay climax service bagsThere are generally several shops that furnish "degradable" Delay climax transporter packs, (in any other case called 'oxo-degradable', 'oxo-biodegradable' or even 'uv degradable'). Degradable bags are created beyond oil-inferred Premature ejaculation also maintain added in chemicals which body language while boosters to speed up the debasement course of action. These types of added in ingredients stop working underneath UV display, air, high temperature or mechanised stress and anxiety, departing simple dust of plastic-type material. These may after that maybe biodegrade, decreasing the information to be able to drinking water, Carbon, bio-mass and follow elements. This methodology will take some years.It can be unknown just what the full aftereffect of joining degradable and also recognized plastic-type wearer bags should have providing these people type in the plastic material things platform with extensive numbers. Degradable bags aren't guaranteed while "compostable" and do not get used to this known American normal intended for naturally degradable parts Dentro de 13432.Biodegradable service bagsThese service bags are not consequently usually made use of by stores as they are significantly less solid for the same way of measuring materials. They may be produced beyond green collect decided options (at the.grams. corn starch). These are commonly created to eco-friendly within vigorous efficient compost conditions and might participate in for you to EN 13432. The packages will not be designed to corrupt with land fill situations. They are often rich compost capable in house composting http://www.hermesbeltsbirkinkellybag.co.uk/ conditions. At the moment, there is only a British perseverance intended for home compost-ability, not much of a regular.Informative content Piece with Biopolymers.Paper bagsWhile papers service provider bags are from any green source and therefore are eco-friendly, compostable and recyclable, they need primarily much more energy to produce as well as transport compared to plastic material provides and regularly currently have restricted re-usability. Providing left inside garbage dump, they can be susceptible to damaged in addition to relieve methane.Natural materialsJute and also natural cotton are designed outside of plant life that need a clutter water and also manure to formulate along with vitality in order to reap as well as approach straight into sacks. That they hearten re-use, and could be reprocessed with the end of these helpful lifestyle while, for example, addresses utilised by evacuation corporations. In case dumped inside landfill, they can be at risk of tainted.

Comment by stephanieg915 3 days ago

Just what exactly much better suggestion of your product can some sort of perfumer desire fot it of your hottie for instance Lana turner, that whenever specified that the only position she wore during sexual intercourse have been a few droplets involving Simply no. 5?Another issue together with brand name purses is actually coloration. You do not must stay with the over 60's hues regarding darkish, dark-colored and suntan any more. You can now keep these things created to accentuate cooler areas within your clothing. Getting working together costumes with the toned wallet and also bag may very well be executed inside red-colored, olive or maybe a glowing bronze along with a wealthy magenta. Possessing among every tone will definitely help you stay ready to reprogram your branded purses and also purses to help synchronize effectively using your outfit. Do not simply take advantage of the same 1 regularly.Countries Made: Bookbag possesses assorted production services outside England. Considering the design and style, LV bags are usually at this time being produced beyond Italy, in places including USA, Indonesia, Italia, Southern spain along with Exercise form evident Portugal. And so, don't even think your LV bag is a low real one only as it is produced outside People from france.Chanel ended up being which happy, a whole lot to ensure its fragrance, that was made in 1921, nevertheless continues its manufacturer innovator a number of years later. Simply no. Five was handed it's name by means of "Mademoiselle" simply because it had been your fifth container the lady determined among the models provided to your ex and it also ended up being due to possibly be released within Could, the 5th thirty day period. This unique potion can be the very best marketing cologne for women given that and is currently pushing the 5 Per-cent mark with planet share of the market.Kyle Richards and as well his / her brother, Ellie Richards, appear to in addition have their own reasonable share involving dramatization totally and it also has been extremely apparent the volume of damage which in fact had been completed to exactly what when was a rather copacetic joint venture.As an outcome of the brand-new polices, Italy's tough access, Prada Luna Rossa, has in fact risked never to competition before their particular problems are generally read as well as adjudicated.Before opting in order to tips on how to determine Replica Draw Heuer Microtimer it is vital you know a replica must not be sub-par to the original observe inside a large suggests. Although not many Label Heuer Repeat creators may not have accessibility very best of material, you will find people that can certainly utilize content used from the original designer watches. In spite of this, the price of most of these illegal copies will be lessened when compared to the valuation on the initial. The component behind that lies in the advantage that a duplicate won't impose a fee to the brand name.It only took many years before the Vuitton name was grasped all throughout European countries. All through his or her existence, Louis was obviously a http://www.hermesbeltsbirkinkellybag.co.uk/ a nice touch within the vogue globe. Which is proved through the various endeavors he / she completed, all which panned away beautifully.

Comment by stephanieg915 3 days ago

www.canadagoosefemmehomme2016.fr/manteau-type-canada-goose_369.html

www.canadagoosefemmehomme2016.fr/canada-goose-modele-victoria_409.html

www.canadagoosefemmehomme2016.fr/parka-expedition-canada-goose_452.html

www.canadagoosefemmehomme2016.fr/canada-goose-vs-pjs_443.html

www.canadagoosefemmehomme2016.fr/canada-goose-taille-grand-ou-petit_112.html

www.canadagoosefemmehomme2016.fr/canada-goose-parajumpers_49.html

www.canadagoosefemmehomme2016.fr/canada-goose-le-bon-march��_461.html

www.canadagoosefemmehomme2016.fr/parka-montebello-canada-goose_379.html

www.canadagoosefemmehomme2016.fr/canada-goose-femme-chilliwack_113.html

www.canadagoosefemmehomme2016.fr/ou-acheter-une-canada-goose_313.html

www.canadagoosefemmehomme2016.fr/canada-goose-chateau-parka_247.html

www.canadagoosefemmehomme2016.fr/canada-goose-chilliwack-enfant_431.html

www.canadagoosefemmehomme2016.fr/canada-goose-ou-parajumpers_414.html

www.canadagoosefemmehomme2016.fr/prix-canada-goose-femme_206.html

www.canadagoosefemmehomme2016.fr/canada-goose-montpellier_353.html

www.canadagoosefemmehomme2016.fr/canada-goose-rundle_453.html

www.canadagoosefemmehomme2016.fr/manteau-canada-goose-homme_279.html

www.canadagoosefemmehomme2016.fr/canada-goose-solaris-parka_375.html

www.canadagoosefemmehomme2016.fr/canada-goose-femme-pas-cher_139.html

www.canadagoosefemmehomme2016.fr/canada-goose-quebec_125.html

www.canadagoosefemmehomme2016.fr/canada-goose-promotion-france_98.html

www.canadagoosefemmehomme2016.fr/ecusson-canada-goose_168.html

www.canadagoosefemmehomme2016.fr/canada-goose-veste-femme_363.html

www.canadagoosefemmehomme2016.fr/canada-goose-femme-grise_145.html

www.canadagoosefemmehomme2016.fr/canada-goose-sans-fourrure_311.html

www.canadagoosefemmehomme2016.fr/canada-goose-taille-xs_224.html

www.canadagoosefemmehomme2016.fr/veste-canada-goose-femme-pas-chere_357.html

Comment by sguerra376 1 day ago

Your point of view

You must be signed in to comment.