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

Expand shortened URLs

Terminal - Expand shortened URLs
expandurl() { curl -sIL $1 | grep ^Location; }
2011-10-19 00:56:53
User: atoponce
Functions: grep
5
Expand shortened URLs

curl(1) is more portable than wget(1) across Unices, so here is an alternative doing the same thing with greater portability. This shell function uses curl(1) to show what site a shortened URL is pointing to, even if there are many nested shortened URLs. This is a great way to test whether or not the shortened URL is sending you to a malicious site, or somewhere nasty that you don't want to visit. The sample output is from:

expandurl http://t.co/LDWqmtDM

Alternatives

There are 2 alternatives - vote for the best!

Terminal - Alternatives
check(){ curl -sI $1 | sed -n 's/Location: *//p';}
expandurl() { curl -s "http://api.longurl.org/v2/expand?url=${1}&format=php" | awk -F '"' '{print $4}' }
2013-01-19 10:40:46
User: atoponce
Functions: awk
Tags: curl longurl
2

This relies on a public API from http://longurl.org. So, this has the weakness that if the service disappears, the function will break. However, it has the advantage that the shortened URL service will not be tracking your IP address and other metrics, but instead will track longurl.org. Thus, you can remain anonymous from the shortened URL services (although not anonymous from longurl.org). It does no sanity checking that you have provided an argument. If you do not provide one, "message" is displayed to STDOUT.

expandurl() { wget -S $1 2>&1 | grep ^Location; }
2011-10-18 18:50:54
User: atoponce
Functions: grep wget
Tags: wget
0

This shell function uses wget(1) to show what site a shortened URL is pointing to, even if there are many nested shortened URLs. This is a great way to test whether or not the shortened URL is sending you to a malicious site, or somewhere nasty that you don't want to visit. The sample output is from:

expandurl http://t.co/LDWqmtDM
expandurl() { curl -sIL $1 2>&1 | awk '/^Location/ {print $2}' | tail -n1; }
2011-10-19 01:35:33
Functions: awk tail
Tags: curl
0

This shell function uses curl(1) as it is more portable than wget(1) across Unices, to show what site a shortened URL is pointing to, even if there are many nested shortened URLs. It is a refinement to www.commandlinefu.com/commands/view/9515/expand-shortened-urls to make it better for use in scripts. Only displays final result.

expandurl http://t.co/LDWqmtDM
curl -s http://urlxray.com/display.php?url=http://tinyurl.com/demo-xray | grep -o '<title>.*</title>' | sed 's/<title>.*--> \(.*\)<\/title>/\1/g'
2010-09-30 10:25:18
User: karpoke
Functions: grep sed
Tags: sed grep curl
-3

We can put this inside a function:

fxray() { curl -s http://urlxray.com/display.php?url="$1" | grep -o '<title>.*</title>' | sed 's/<title>.*--> \(.*\)<\/title>/\1/g'; }; fxray http://tinyurl.com/demo-xray

Know a better way?

If you can do better, submit your command here.

What others think

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

http://www.canadagoosejacketssale.us.com

http://www.cheapraybans-sunglasses.us.com

http://www.michaelkorsoutletofficials.us.com

http://www.christian-louboutinoutlet.us.org

http://www.christianlouboutin.com.co

http://www.ralphlaurenpoloshirts.me.uk

http://www.lacosteoutlet.us.org

http://www.adidasshoes.us.org

http://www.coachfactoryoutletonlinestores.us.com

http://www.ralph-laurenpolooutlet.us.com

http://www.mont-blancpens.us.com

http://www.michaelkorsoutletclearancee.us.com

http://www.fitflopsaleclearance.us.com

http://www.polooutlet.name

http://www.coachfactoryoutletofficials.us.com

http://www.raybansunglassesformen.us.com

http://www.mbtshoesoutlets.us.com

http://www.oakley-sunglassesoutletonline.us.com

http://www.nikeshoes.com.co

http://www.cheapuggboots.name

http://www.cheapuggboots.org

http://www.raybansun-glasses.com.co

http://www.fredperry.org.uk

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

http://www.valentinooutlet.in.net

http://www.polooutletralphlauren.us.com

http://www.oakleysunglasseswholesaler.us.com

http://www.montblancpensoutlet.com

http://www.ralphlauren-polo.me.uk

http://www.yeezyboost350-v2.us.com

http://www.mcmoutletonline.us

http://raybansunglasses.co-sunglasses.com

http://nikeshoes.nike-com.com

http://www.oakley-sunglassesclearance.us.com

http://www.truereligionjeanss.us.com

http://www.pandoraoutlets.us.com

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

http://www.lunetterayban.fr

http://www.airjordan4.us

http://www.canadagooseoutlet-store.com.co

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

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

http://www.mlbjerseys.net

http://www.adidasyeezyshoes.name

http://www.poloralphlaurenfactorystore.us.com

http://www.cheapjordans.name

http://www.edhardyclothing.us.com

http://www.michaelkorsoutletclearancehandbags.us.com

http://www.polo-ralphlaurenuk.me.uk

http://www.fitflops-saleclearance.us

http://www.cheapmlb-jerseys.us

http://www.nikeshoesoutlet.us.com

http://polooutlet.amegov.com

http://www.katespadeshandbags.us

http://www.ralphlauren-outletuk.org.uk

http://www.canadagoose.name

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

http://www.ralphlaurenoutlets.org.uk

http://www.michaelkorsoutlet-online.in.net

http://www.fredperrypoloshirts.co.uk

http://www.kate-spadeoutlet.us.org

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

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

http://www.polo-ralphlauren-pascher.fr

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

http://www.mbtshoescheap.us.com

http://www.pradaoutletstore.us

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

http://poloralphlauren.amegov.com

http://www.true-religionoutletstore.us.com

http://www.lebron-jamesshoes.us.com

http://www.cheapuggs.name

http://www.michaelkorsoutlet-clearance.org

http://www.oakleysunglasseswholesales.us.com

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

http://adidasyeezyshoes.adidassale.net

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

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

http://www.longchampoutlet.us.org

http://www.nikeoutlet.com.co

http://www.oakleysunglasseswholesalee.us.com

http://www.oakleysunglassescheaps.us.com

http://www.fredperryoutlet.us.com

http://www.longchampoutletofficial.us.com

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

http://www.adidasoutlet.com.co

http://www.asicsrunningshoes.us.com

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

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

http://www.oakleysunglassesformen.us.com

http://www.nhljerseyss.us.com

http://cheapraybansunglasses.co-sunglasses.com

http://www.coachfactoryoutletmiami.us.com

http://www.coachoutletcoachoutletstore.us.com

http://www.adidasoutlet.us.org

http://www.cheapjordansfor-sale.us.com

http://www.michaelkorsoutletofficial.com

http://www.hermesbeltsoutlet.us.com

http://www.pandoraoutletstore.us.com

http://www.michaelkorsoutlet-clearance.us

http://www.ralphlauren-shirts.org.uk

http://www.ralphlaurenoutletonlinestore.us.com

http://www.ralphlaurenofficial.us.com

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

http://www.michaelkorsoutletonlinestore.us.org

http://www.oakleysunglassesfactory.us.com

http://www.polooutlet.us.org

http://www.raybanssun-glasses.com.co

http://www.coachoutletonlinecoachfactoryoutlets.us.com

http://www.michaelkorssoutletclearance.us.com

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

http://nikeshoes.up-nike.com

http://www.poloralph-laurenuk.co.uk

http://www.michael-korsoutletstore.in.net

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

http://www.canadagoosejacketss.com.co

http://www.christian-louboutinshoes.us

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

http://www.cheapnfljerseys.eu.com

http://www.mlbjerseys-wholesale.us.com

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

http://www.nike-shoes.us.org

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

http://www.ralph-laurenpolo.us.org

http://www.raybansunglassesonsale90off.us.com

http://www.fitflopssaleclearance.name

http://www.coachoutletcoachfactoryoutlets.us.com

http://www.airjordan.us.org

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

http://raybansunglassesoutlet.co-sunglasses.com

http://www.uggoutlet.name

http://www.oakleysunglassesss.us.com

http://www.canadagooses.com.co

http://www.ralphlaurenshirts.me.uk

http://www.michaelkorsoutlet-clearance.com

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

http://www.oakleysunglasseswholesaleonline.us.com

http://www.coachoutletonlinecoachfactoryoutlet.com.co

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

http://www.nbajerseyss.us.com

http://yeezyboost.adidassale.net

http://www.nikeoutletstorelocations.com

http://www.montblancpenss.com.co

http://www.pandorajewelrycharms.us.com

http://www.mulberryhandbagsuk.co.uk

http://www.hermesbirkins.us.com

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

chenlili20170503

Comment by chenyingying 20 weeks and 4 days ago

Here Chiropractors http://www.huaracherunpas-cher.fr/air-huarache-grise_142.html are also known http://www.huaracherunpas-cher.fr/huarache-2017_99.html when physicians involving chiropractic. http://www.huaracherunpas-cher.fr/air-flight-huarache_68.html A new chiropractors work consists of figuring http://www.huaracherunpas-cher.fr/nike-air-huarache-og-retro_101.html out as well http://www.huaracherunpas-cher.fr/nike-air-huarache-light-ultramarine-og_75.html as the treatment of http://www.huaracherunpas-cher.fr/nike-huarache-gris_59.html affected individuals with a lot http://www.huaracherunpas-cher.fr/huarache-bordeaux_53.html of medical problems belonging http://www.huaracherunpas-cher.fr/nike-air-huarache-blanche_153.html to the bone http://www.huaracherunpas-cher.fr/air-nike-huarache_107.html and bone and http://www.huaracherunpas-cher.fr/huarache-instagram_169.html joint technique. Healing the http://www.huaracherunpas-cher.fr/huarache-acheter_83.html issues along with http://www.huaracherunpas-cher.fr/nike-huarache-pour-femme_155.html the negative effects of people http://www.huaracherunpas-cher.fr/huarache-air-max_163.html complications will be the # http://www.huaracherunpas-cher.fr/nike-air-flight-huarache-og_48.html 1 objective. Maple http://www.huaracherunpas-cher.fr/nike-huarache-run-pas-cher_61.html grove chiropractic treatment makes use of the http://www.huaracherunpas-cher.fr/nike-huarache-jd_46.html actual wellbeing on http://www.huaracherunpas-cher.fr/nike-id-huarache_158.html the individual to help http://www.huaracherunpas-cher.fr/nike-air-force-huarache_124.html you offer http://www.huaracherunpas-cher.fr/nike-air-huarache-1991_65.html cures devoid of drugs or perhaps medical http://www.huaracherunpas-cher.fr/air-huarache-run_157.html procedures. http://www.huaracherunpas-cher.fr/huarache-noir-et-rose_109.html Doctors of chiropractic are capable of http://www.huaracherunpas-cher.fr/nike-huarache-run_72.html helping together with retrieval http://www.huaracherunpas-cher.fr/acheter-huarache_84.html as well http://www.huaracherunpas-cher.fr/nike-huarache-solde_94.html as recognize many points which http://www.huaracherunpas-cher.fr/nike-air-huarache-homme_150.html affect a patients wellbeing which include http://www.huaracherunpas-cher.fr/nike-huarache-prix_66.html exercise and http://www.huaracherunpas-cher.fr/huarache-chaussures_95.html diet, heredity and also ambient http://www.huaracherunpas-cher.fr/nike-huarache-beige_91.html setting. Including several medical http://www.huaracherunpas-cher.fr/nike-air-huarache-international_104.html practitioners, chiropractic http://www.huaracherunpas-cher.fr/air-huarache-solde_40.html specialists usually have a routine to have http://www.huaracherunpas-cher.fr/nike-air-huarache-prix_120.html a medical diagnosis http://www.huaracherunpas-cher.fr/nike-huarache-3_108.html also to http://www.huaracherunpas-cher.fr/air-huarache-noir_116.html produce a therapy. Including http://www.huaracherunpas-cher.fr/huarache-noir_86.html any halth background and http://www.huaracherunpas-cher.fr/nikeair-huarache_88.html real and various tests in http://www.huaracherunpas-cher.fr/air-max-huarache_39.html addition to tests. http://www.huaracherunpas-cher.fr/huarrache-blanche_135.html X rays and lots of http://www.huaracherunpas-cher.fr/nike-air-huarache-pas-chere_161.html other types of http://www.huaracherunpas-cher.fr/nike-huarache-light-og_115.html diagnostic tests can be with http://www.huaracherunpas-cher.fr/boutique-nike-huarache_151.html an concentrate on a vertebrae http://www.huaracherunpas-cher.fr/nike-air-huarache-original_144.html and other http://www.huaracherunpas-cher.fr/nike-huarache-usa_114.html our bones. Chiropractic professionals look in stance http://www.huaracherunpas-cher.fr/nike-huarache-boutique_147.html and also the back http://www.huaracherunpas-cher.fr/air-huarache-femme_90.html bone, and will http://www.huaracherunpas-cher.fr/huarache-4_118.html attempt to locate the http://www.huaracherunpas-cher.fr/nike-huarache-blanc_85.html down sides in http://www.huaracherunpas-cher.fr/huarache-nike-blanche_127.html addition to problems straight http://www.huaracherunpas-cher.fr/chaussures-air-huarache_128.html down intended for cure.There a wide http://www.huaracherunpas-cher.fr/air-huarache-og_71.html range of http://www.huaracherunpas-cher.fr/nike-air-huarache-run_43.html forms of treatment plans http://www.huaracherunpas-cher.fr/chaussure-nike-air-huarache_76.html applied for example http://www.huaracherunpas-cher.fr/nike-huarache-homme_141.html restorative massage, h2o and warm, light-weight as http://www.huaracherunpas-cher.fr/air-huarache-nike_87.html well as power voltages http://www.huaracherunpas-cher.fr/nouvelle-nike-huarache_82.html or perhaps http://www.huaracherunpas-cher.fr/nike-huarache-violet_54.html acupuncture in some instances. http://www.huaracherunpas-cher.fr/nike-air-huarache-run-pas-cher_98.html Helps are commonly employed in http://www.huaracherunpas-cher.fr/huarache-enfant_62.html train which include footage along http://www.huaracherunpas-cher.fr/nike-huarache-free-run-2012_146.html with orthodontics, http://www.huaracherunpas-cher.fr/air-huarache-paris_138.html shoe inserts plus band. The http://www.huaracherunpas-cher.fr/basket-huarache_63.html chiropractor will normally http://www.huaracherunpas-cher.fr/air-huarache-blanc_123.html aide a person http://www.huaracherunpas-cher.fr/huarache-og-2017_143.html in overall health procedures http://www.huaracherunpas-cher.fr/huarache-usa_100.html like exercise, eating plan in addition http://www.huaracherunpas-cher.fr/air-huarache-noire_117.html to eating habits http://www.huaracherunpas-cher.fr/nike-air-huarache-mid_78.html as well as stress managing http://www.huaracherunpas-cher.fr/nike-huarache-toute-noir_154.html ; there aren't medications with out http://www.huaracherunpas-cher.fr/huarache-5_74.html surgeries http://www.huaracherunpas-cher.fr/nike-huarache-chaussures_129.html ever before performed by some http://www.huaracherunpas-cher.fr/huarache-femmes_170.html sort of chiropractic specialist. Several http://www.huaracherunpas-cher.fr/huarache-noir-femme_60.html chiropractic health care professionals http://www.huaracherunpas-cher.fr/nike-huarache-noir-et-bleu_130.html is going to http://www.huaracherunpas-cher.fr/basket-nike-huarache_45.html be pros with parts http://www.huaracherunpas-cher.fr/nike-air-huarache-light-ultramarine_64.html which include orthopedics, healthy eating http://www.huaracherunpas-cher.fr/nike-air-huarache-beige_112.html plan, inside http://www.huaracherunpas-cher.fr/nike-air-huarache-light-pas-cher_44.html issues, workplace injuires or http://www.huaracherunpas-cher.fr/chaussure-air-huarache_180.html perhaps neurology.Chiropractors commonly function in a comfortable http://www.huaracherunpas-cher.fr/free-huarache_103.html natural environment, and http://www.huaracherunpas-cher.fr/nike-air-huarache-taille_172.html are also known http://www.huaracherunpas-cher.fr/nike-air-huarache-light_168.html to be standing for long http://www.huaracherunpas-cher.fr/huarache-bleu_111.html periods of time. http://www.huaracherunpas-cher.fr/huarache-nike-chaussures_131.html Individuals who consist of x-rays in http://www.huaracherunpas-cher.fr/huarache-free-run_145.html the treatment plans must http://www.huaracherunpas-cher.fr/huarache-vintage_42.html dress in http://www.huaracherunpas-cher.fr/nike-air-huarache-2_92.html special items to forestall potential http://www.huaracherunpas-cher.fr/nike-air-huarache-turquoise_160.html risks coming from extended http://www.huaracherunpas-cher.fr/nike-huarache-2_166.html contact light. Chiropractic doctors typically http://www.huaracherunpas-cher.fr/nike-huarache-leopard_57.html function your http://www.huaracherunpas-cher.fr/nike-huarache-paris_69.html 30 hour 1 week just like http://www.huaracherunpas-cher.fr/air-huarache-homme_67.html a great many http://www.huaracherunpas-cher.fr/nike-huarache-fille_148.html other employment, although longer http://www.huaracherunpas-cher.fr/nike-air-huarache-solde_181.html hours can http://www.huaracherunpas-cher.fr/nike-huarache-free-run-pas-cher_156.html be located. Several experts which work http://www.huaracherunpas-cher.fr/nike-huarache-safari_52.html by itself sets http://www.huaracherunpas-cher.fr/nike-air-flight-huarache_102.html their own hours http://www.huaracherunpas-cher.fr/chaussures-huarache_56.html and might function night time and http://www.huaracherunpas-cher.fr/huarache-light_50.html also saturdays http://www.huaracherunpas-cher.fr/nike-huarache-noir-et-rose_58.html and sundays to guarantee their http://www.huaracherunpas-cher.fr/nike-air-huarache-90_110.html sufferers provide the situations http://www.huaracherunpas-cher.fr/nike-huarache-taille_49.html they want. Several conversely, take presctiption http://www.huaracherunpas-cher.fr/nike-air-huarache-og_162.html call due to http://www.huaracherunpas-cher.fr/ being within a http://www.huaracherunpas-cher.fr/huarache-nike-pas-cher_79.html big group process.All chiropractic specialists need http://www.huaracherunpas-cher.fr/nike-air-huarache-bleu_167.html to http://www.huaracherunpas-cher.fr/nike-air-huarache-safari_73.html be accredited experts, and this also http://www.huaracherunpas-cher.fr/nike-huarache-ultramarine_125.html may take http://www.huaracherunpas-cher.fr/nike-huarache-rouge_81.html about Four years with undergraduate get http://www.huaracherunpas-cher.fr/nike-huarache-premium_126.html the job http://www.huaracherunpas-cher.fr/nike-huarache-femmes_182.html done after which it an additional http://www.huaracherunpas-cher.fr/huarache-leopard_77.html Four years with http://www.huaracherunpas-cher.fr/nike-air-zoom-huarache_89.html Chiropractic care College or university http://www.huaracherunpas-cher.fr/nike-huarache-1991_55.html or a country wide board http://www.huaracherunpas-cher.fr/nike-huarache_93.html assessment while http://www.huaracherunpas-cher.fr/chaussure-huarache-nike_173.html stating licensure quiz. The vast http://www.huaracherunpas-cher.fr/huarache-noir-et-blanc_96.html majority of express http://www.huaracherunpas-cher.fr/air-huarache-light_139.html licensing discussion boards check http://www.huaracherunpas-cher.fr/nike-huarache-marron_165.html with that a http://www.huaracherunpas-cher.fr/nike-huarache-femme-pas-cher_140.html no less than A couple of http://www.huaracherunpas-cher.fr/huarache-og_183.html years undergraduate operate often be http://www.huaracherunpas-cher.fr/chaussures-huarache-nike_152.html completed and others http://www.huaracherunpas-cher.fr/huarache-chaussure_122.html at the moment are http://www.huaracherunpas-cher.fr/nike-huarache-agassi_133.html requesting which a bachelors http://www.huaracherunpas-cher.fr/nike-huarache-magenta_51.html degree possibly be http://www.huaracherunpas-cher.fr/huarache-light-og_105.html bought. A new driving level http://www.huaracherunpas-cher.fr/nike-air-huarache-blanc_41.html with a http://www.huaracherunpas-cher.fr/nike-air-huarache-chaussures_80.html minimum of 75% have to be http://www.huaracherunpas-cher.fr/nike-huarache-2013_159.html created for a doctors http://www.huaracherunpas-cher.fr/nike-air-huarache-rouge_47.html of chiropractic http://www.huaracherunpas-cher.fr/nike-huarache-id_164.html countrywide aboard quiz, as with http://www.huaracherunpas-cher.fr/huarache-beige_106.html most other specialist along http://www.huaracherunpas-cher.fr/nike-air-huarache-retro_70.html with heath care treatment careers.Chiropractors are http://www.huaracherunpas-cher.fr/huarache-montante_179.html generally mistaken http://www.huaracherunpas-cher.fr/nike-air-force-1-huarache_113.html using athletic teachers http://www.huaracherunpas-cher.fr/nike-huarache-light-ultramarine_171.html as well as massage therapy http://www.huaracherunpas-cher.fr/nike-air-huarache-noir_97.html counselors given that http://www.huaracherunpas-cher.fr/nike-huarache-free-light_134.html they additionally handle individuals http://www.huaracherunpas-cher.fr/huarache-run_132.html as well as prevent http://www.huaracherunpas-cher.fr/nike-air-huarache-run-chaussures_174.html pain and also diseases. However in http://www.huaracherunpas-cher.fr/huarache-nike-noir_149.html order to have a http://www.huaracherunpas-cher.fr/achat-nike-huarache_137.html job in a choice http://www.huaracherunpas-cher.fr/nike-air-max-huarache-hybrid_121.html of those different professions, the level of education is dramatically lowered without any condition panel demands are located on record for these placements. Closest medical doctor to a chiropractic doctor specialist in the exact discipline is usually a podiatrist, as much doctors of chiropractic could focus on other locations.

Comment by scott154 3 weeks and 3 days ago

Seems that some shorteners return lower case "Location" in headers so perhaps grep -i should be used.

Comment by oneguycoding 1 week and 1 day ago

Your point of view

You must be signed in to comment.