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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

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

function to edit your history file

Terminal - function to edit your history file
eh () { history -a ; vi ~/.bash_history ; history -r ; }
2011-03-23 18:00:20
Functions: vi
7
function to edit your history file

eh stands for Edit History

.

Frequently, I'll mistype a command, and then step back through my history and correct the command. As a result, both the correct and incorrect commands are in my history file. I wanted a simple way to remove the incorrect command so I don't run it by mistake.

.

When running this function, first the ~/bash_history file is updated, then you edit the file in vi, and then the saved history file is loaded back into memory for current usage.

.

while in vi, remember that `Shift-G` sends you to the bottom of the file, and `dd` removes a line.

.

this command is different than bash built-in `fc` because it does not run the command after editing.

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

I really like this one

Comment by linuxrawkstar 279 weeks and 3 days ago

Wouldn't history -d #, where # is the number of the mistyped command, have been faster more efficient?

Comment by epoch 278 weeks and 3 days ago

`history -d` will work if you know the exact offset and all you wish to do is delete a line. You could do a `history|tail` to be sure of that offset so to not accidentally blow away the wrong command

.

But this function lets you edit your history file too. So you could remove that password from the command line mysql querry. or you could append that successful command with a comment like thus :

.

ssh [email protected] #insert history keyword here

.

It's also faster if you wish to wipe the last ten commands

Comment by unixmonkey8121 278 weeks ago

eh () { history -a ; vi + ~/.bash_history ; history -r ; }

.

adding the `+` when evoking `vi` causes the file to open at the very last line. Since you usually want to edit something within say 20 lines of the bottom, this is useful but optional upgrade

Comment by unixmonkey365 241 weeks and 2 days ago

scream, www.marcjacobs.us.com or www.coachoutletstore.net.co enjoy www.canada-goosesjackets.us.com the www.tommy-hilfiger-canada.ca cicadas www.louboutin.jp.net flap www.new-balance.ca its www.jimmy-chooshoes.com wings www.guccishoes.in.net when www.designerhandbagsoutlet.net.co you www.hollisteronlineshop.com.de bring www.oakley--sunglasses.com.au the www.newoutletonlinemall.com cool www.ugg-uggboots.net wind; www.rolex-watch.me.uk when www.pradaoutlet.com.co passing www.bottega-veneta.us.com Hasuike www.ralph-laurens.org.uk also puffed www.louis-vuitton-australia.com.au breath www.the-northface.net.co goods www.hollister-abercrombie.com.se products www.mk-outlet.us.com that www.mcmbags.net Lotus www.michael-kors-handbags.us.com aroma; www.giuseppezanotti.com.co hours www.rayban.org.es because www.swarovski-australia.com.au ignorance www.beatsbydre.com.co has www.toms-shoesoutlet.net been www.rayban-wayfarer.in.net poked www.retro-jordans.com hornet's www.hollisterclothingstore.org nest www.toms--outlet.com.co and www.wedding--dresses.ca stung airmax.misblackfriday.com his www.coachoutlet-online.com.co face www.bcbg-dresses.com was www.pandorajewellery.com.au bruised. www.newbalance.com.es Dig www.giuseppe-zanotti.net once, www.truereligion-outlet.com.co because www.bottegaveneta-bagsoutlet.com "small www.swarovskijewelry.com.co insects" www.tiffanyandco-canada.ca (Sparrow) www.adidas.org.es and www.hollister.us.org took www.hogan.com.de out www.chiflatiron.net.co a "snake" www.woolrich-clearance.com (Snake) www.nike-air-max.ca scared www.cheapoakley-sunglasses.in.net to www.adidasshoes.top fall www.michaelkorsoutletonline-sale.us.com from www.rolex-watches.us.com the www.mcmhandbags.com.co wall. Fortunately, www.coachoutletstore-online.com.co nothing www.nike-air-max.com.se serious. www.burberrys-outlet2016.com Leisure www.yoga-pants.net.co time, www.lululemon-australia.com.au will www.cheapmichaelkors.us.org collect www.eyeglassesonline.us.com some www.pulseras-pandora.com.es cigarette www.burberry-handbagsoutlet.com.co paper www.ralph-laurenoutlet.ca folded www.guccioutlet-sale.in.net triangle, www.designer-handbagsoutlet.us.com and www.cheaprayban.com.co partners www.longchamp-handbagsoutlet.us.com to www.nikefactory.org play; www.uggs.in.net (the www.michaelkorsoutlet.ar.com triangle on www.toms-shoes.net.co the www.ralph-lauren.com.au ground www.instylers.us.com and www.thejoreseproject.com put www.timberlandbootsoutlet.us.com his www.nike-rosherun.nl hand www.louis-vuitton-taschen.com.de on www.timberlandshoes.net.co the ground quick www.coach-factory.in.net photo www.pumaonline-shop.de shoot www.christianlouboutinshoesoutlet.org the www.michael-kors-canada-outlet.ca other www.rosheruns.us side www.babyliss-pro.us.com of www.nike-airmaxinc.co.uk the www.adidas-superstar.nl triangle www.nikefree-run.org.uk is www.prada-shoes.com.co the www.raybans.us.org triangle www.ralphs-lauren.co.uk that www.prada-handbags.com.co turned www.coachblackfriday.com their www.salvatoreferragamo.in.net a); www.moncler-outlet.us.org and www.tomsoutlet-online.com also www.maccosmetics.gr.com than www.p90xworkout.us.com own www.nike.org.es older www.polo-outlets.com.co brother www.edhardy.us.org and www.swarovski-online-shop.de sister www.michaelkors-uk.org.uk were www.cheap-raybans.com led to www.airmax-90.org a www.weddingdressesuk.org.uk wide www.longchamp.com.co flat www.barbour-jacketsoutlet.com on www.converse.com.de the www.asicsgels.de grass or www.ralphlaurenoutlet.us.com doing www.tiffany-jewelry.net "of www.oakley.com.de chicken" www.michael-kors.net.co or www.polos-ralphlauren.us.com "kill www.rayban-sunglasses.us.org the www.nikeskos.dk lamb" www.christian-louboutinshoes.com.co of www.hermesbags.jp.net the www.tommy-hilfiger.com.de game, www.the-northface.com.co before www.air-huarache.co.uk the www.lululemoncanada.ca election www.tommy-hilfiger.co.nl when www.ralphlaurenpolos.in.net one www.chanelhandbags.net.in eagle, nike.shoesoutlet.us.com then www.adidas.com.se tall www.canadagooses-2016.com in www.chanel-bags.com.co front www.toryburchoutlet-sale.us.com when www.ferragamo.com.co hens airhuarache.shoesoutlet.us.com , www.swarovski--uk.me.uk when www.nikemercurial.in.net the www.thenorthfacejackets.net.co rest www.rayban-sunglassesoutlet.co.uk of www.airhuarache.co.uk the www.michael-kors-outlet-online.us.org chicken, www.cheap-nike-shoes.net the www.uggs-onsale.net eagle www.coach-purseoutlet.net chasing www.ralphslauren-outlet.co.uk shot at www.tiffanyand-co.net.co the www.the-northfacejackets.us.com back www.oakleys-glasses.us.com of www.mcm-handbags.org the www.jordanrelease-dates.us.com chick, www.louisvuittons.com.co hen www.newbalance-outlet.org with www.pandora-charms.org.uk open www.michaelkors-outlet-online.com.co arms www.tiffany-und-co.de to www.swarovskicanada.ca protect www.coach-outletonline.net.co chickens, www.tory-burchshoesoutlet.net smart dodge www.oakley-sunglasses-canada.ca to www.longchamps.us.com keep www.ugg-bootsclearance.com eagle www.nike-schoenen.co.nl patting. www.ghd-hairstraightener.net Or www.coco-chanel.com.de a www.ralphlauren-polos.co.uk dozen www.cheap-michaelkors.com people www.airmax-2015.org sitting www.kate-spade.gb.net in www.abercrombie-and-fitch.us.com a circle, www.abercrombie-hollister.nl do www.nikefree-run.net a www.longchampoutlet.com.co do www.jordan-shoes.com.co Diushou Juan www.nikestore.com.de game: the www.hermesbirkin-bag.net hands www.louis-vuittonblackfriday.com of www.tommyhilfiger.net.co only www.coco-chanels.us.com one www.guccishoes.com.co person supra.shoesoutlet.us.com to www.replicarolex-watches.us.com take www.longchamp-bags.us.com the handkerchief www.thenorth-faces.co.uk out www.raybans-sunglassesoutlet.in.net of www.pradahandbags.net.co his mouth in www.burberryoutlet-sale.in.net a www.ugg-boots-australia.com.au circle www.nike-schuhe.com.de singing www.cheapshoes.com.co Diushou www.insanity-workout.us.com Juan www.tomsoutletonline.net songs, www.adidas-superstar.de danced www.rolexwatches-canada.ca around www.oakleyoutlet.ar.com the www.cheapuggboots.us.com circle www.christian--louboutin.in.net turning www.nike-air-max.com.de quietly www.abercrombie-kids.us.com throw www.cheapoakley-sunglasses.com the www.handbagsoutlet.net.co handkerchief www.ugg-boots.us.org in www.celine-bags.org the www.ugg-boots.ca back www.louis-vuittonoutletcanada.ca of www.replica-handbags.net.co a www.vans-schuhe.com.de person. www.truereligion-outlet.us.org Then www.newbalance-shoes.org run www.eyeglassframes.in.net around www.michaelkors.com.se in www.lauren-ralph.co.uk circles. www.burberryonlineshop.de If www.the-north-face.ca you www.michaelkorsbags.us.org have www.mcm-bags.in.net a www.montres-pascher.fr lap www.abercrombie-fitchs.us.com behind the www.harrods-london.co.uk handkerchief www.reebok.com.de patting, www.michael-kors.com.co this www.cheap-baseballbats.net people www.jordanretro.org have www.longchamphandbagsoutlet.net not www.christianlouboutinshoes.jp.net found www.iphone-cases.net.co the www.hermes-outlet.com.co person www.converse-shoesoutlet.com you www.ray-ban-outlet.us.com want www.rosherun.org.uk to www.gucci-taschen-outlet.de give a www.ugg-australia.com.de performance uggaustralia.misblackfriday.com for www.louisvuitton.so everyone; www.vans-shoes.co.uk a joke, www.nike-roshe-run.de sing www.michael-kors.com.es songs, www.rayban.co.nl or www.beats-by-dre.com.co back www.burberry2016.co.uk poem. www.burberrys-outlet.co.uk Then www.swarovski-crystal.us.com began www.nike-air-max.us Diushou www.scarpe-hoganoutlets.it Juan by airmax.shoesoutlet.us.com him www.soccer-shoes.us.com or her. www.omega-watches.us.com If www.poloralphlaurenoutlet.net.co this www.jimmy-choos.com is www.tiffany-andco.us.com discovered www.christianlouboutinoutlet.net.co immediately www.mkoutletonline.us.com took www.guccishoes-uk.co.uk the www.salomon-schuhe.com.de handkerchief www.toryburch-sandals.in.net catch www.oakley.org.es Diushou www.michael-kors-australia.com.au Juan www.burberryoutlet2016.us.com people, www.prada.com.de that www.airjordans.us Diushou www.thenorthface.com.de Juan www.cheap-oakleyglasses.us.com will www.louisvuitton-outlet.com.co continue www.burberryoutlet-canada.ca to www.timberlands-paschere.fr lose, www.oakley-outletstore.in.net someone www.pandorajewelry.top who www.nfl-jersey.us.com can www.bebeclothing.in.net back www.louis--vuitton.org.uk into www.tommy-hilfigeroutlet.com place; www.pandora.com.de catch, www.oakleyoutlet-online.us.com and www.thomas-sabos.org.uk throw www.polo-ralph-lauren.de this www.michael-korshandbags.org.uk man www.louisvuitton.jp.net who www.burberrybags-outlet.com has www.tnf-jackets.us.com sat www.mcmsworldwide.com on www.tommy-hilfiger-online-shop.de the www.chi-flatiron.us.com bit when this www.fashionclothes.us.com man www.marc-jacobs.us.com will www.tomsshoes-outlet.us.com be www.michaeljordan.com.de punished www.michael-kors-taschen.com.de performances. www.pumashoes.in.net We www.uggboots.com.de will www.uhren-shop.com.de play www.ralphlauren-polos.com.co along www.beatsbydrdre.co.com with www.cheap-jordans.net a www.michaelkors.so dozen www.tocoachoutlet.com "Stars www.beats-headphone.com.co over www.nikestore.us the www.outlet-burberry.net.co month www.nike-huarache.nl child" www.coach-factoryoutlet.net.co or www.basketballshoes.com.co "cat drilled www.ralphlaurenoutletonline.in.net 72 www.barbour-factory.com holes" www.air-max.com.de game. www.juicycouture.com.co (Read www.truereligionjeans.net.co the www.soft-ballbats.com article www.converse.net.co Network: www.polooutlets-store.com www.sanwen.net)Also www.mmoncler-outlet.com I www.hollister-clothing.in.net remember www.maccosmetics.net.co one www.hollisters-canada.ca summer, www.nike-maxfr.com that www.nike-shoes-canada.ca the www.northfaceoutlet.com.co acquisition www.nike--freerun.co.uk of www.levisjeans.com.co medicinal www.nikeshoesoutlet.org.uk city www.oakley-sunglasses.mex.com recovered www.nikefree5.net cicada www.juicycoutureoutlet.net.co skin www.supra-shoes.org (medical term www.guccihandbags.net.co called www.ralphlaurenoutletonline.us.org cicada), www.omegarelojes.es catty www.christianlouboutin.org.uk two www.adidas--canada.ca five. www.ray-bansunglasses.net So www.toms-outlets.us.com every www.coach-factoryyoutletonline.net day, www.nike-skor.com.se together www.montblanc--pens.in.net with www.toms-shoes.com.co my www.ralphlaurenepolo.com brothers www.nike-air-force.de holding www.cheapjerseys.us.org bamboo, www.soccer-shoesoutlet.com Dianzhe www.oakleysunglasses-cheap.in.net plastic www.zxcoachoutlet.com bags, www.christian-louboutin-shoes.ca and www.nike-roshe-run.com.es from www.rayban.com.de the village www.michaelkors.co.nl in www.uggboots.net.co the www.uggs.co.nl woods to www.kate-spade.in.net find www.gucci-outletstore.com a www.nike-tnrequinpascher.fr tree www.louisvuitton-outlets.us cicada www.calvin-kleins.us.com skin, www.michael-kors-outlet.us.org after www.ralphlaurenoutlet-online.us.com the www.cheapjerseys.com.co end www.uggsaustralia.com.co of www.michael--kors.us.com the www.new-balance-schuhe.de summer, we www.bcbg-max-azria.ca harvest relatively www.asics-outlet.us.com big, www.tiffany-andco.com.au full www.coachhandbags2016.us.com harvest www.longchamp.com.de four www.nike-shoesoutlet.us.com pounds, www.burberry-outlet.net.co to www.ralphlaurenonlineshop.de buy www.nikerosherun.us ten www.horloges-rolex.nl dollars. www.abercrombieand-fitch.ca The www.nikeair-max.es next www.burberry-outletstore.net summer we www.oakleys-sunglasses.us.com look www.ray--ban.ca for www.mizuno-running.net a www.michaelkorsoutlet-online.ar.com summer, www.uggsoutlet.com.co more www.burberry-outletonlinesale.in.net than www.ghdhair-straighteners.co.uk the www.ferragamoshoes.in.net first www.abercrombie-fitchsale.com year www.lululemonoutlet.gb.net looking www.replica-watches.com.co for www.tommyhilfigeroutlet.in.net even more, www.valentino-shoesoutlet.us.com I did www.katespadeoutlet.gb.net not www.burberry-handbags2016.in.net expect www.oakleysunglass-outlet.net there www.nikeair--max.fr to www.vans-shoes.net happily www.yoga-pants.ca after being www.adidas-schuhe-online.de told www.toryburchsale.com.co not www.nike-free-run.de recovered. www.gucci-shoes.net Cicada got www.converse-shoes.net hard www.ray-banocchiali.it skin, www.true-religion.com.co back www.nike-air-max.com.au at home www.thomas-sabo.com.de after shuffling, www.pandora-charms-canada.ca and www.rolexwatchesforsale.us.com

Comment by zyf543 16 weeks ago

You?ve written nice post, I am gonna bookmark this page, thanks for info. I actually appreciate your own position and I will be sure to come back here.

http://mortalkombatxonline.com">mortal kombat x, http://a10games.xyz">a10, http://robloxaz.com">roblox, http://colorswitchaz.com">color switch

Comment by mortalkombatx 10 weeks and 3 days ago

Really great post, Thank you for sharing this knowledge. Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up!..

[url=http://a10games.xyz]a10[/url], [url=http://colorswitchaz.com]color switch[/url], [url=http://mortalkombatxonline.com]mortal kombat x[/url], [url=http://robloxaz.com]roblox[/url]

Comment by mortalkombatx 10 weeks and 3 days ago

I needed to send you the tiny remark so as to say thank you over again over the amazing things you?ve shared at this time.

http://colorswitchaz.com ,

http://mortalkombatxonline.com ,

http://robloxaz.com ,

http://a10games.xyz

Comment by mortalkombatx 10 weeks and 3 days ago

Our professional essay writing http://www.essay-writing.co.uk/ service is cheap and affordable for all.

Comment by CaitlinPlummer 2 weeks and 5 days ago

Your point of view

You must be signed in to comment.