Inserts the results of an autocompletion in the command line

ESC *
Pressing ESC then * will insert in the command line the results of the autocompletion. It's hard to explain but if you look the sample output or do echo ESC * you will understand quickly. By the way, few reminders about ESC : - Hold ESC does the same thing as tab tab - 'ESC .' inserts the last argument of last command (can be done many times in order to get the last argument of all previous commands)
Sample Output
$ echo <ESC><*>
gives
$ echo aaa aab aba abb baa bab bba bbb

$ echo a<ESC><*>
gives
$ echo aaa aab aba abb
but also :

$ <ESC><*>
gives
$ \: \! . .. ... .... \[ \[\[ ]] \{ } 4xml 4xpath 4xslt 4xupdate 822-date 915resolution _a2dismod _a2dissite _a2enmod _a2ensite a2p a2ping aa-audit aa-autodep aa-complain aa-enforce aa-genprof aa-logprof aa-status aa-unconfined accept accessdb aconnect acpi acpi_available acpid acpi_fakekey acpi_listen acroread acyclic

(I stopped but it's basically the list of all the commands).

63
By: Josay
2009-06-14 21:17:40

What Others Think

interesting :) <ESC> * returns all the commands in a row. <ALT><NUM><.> grabs the 'NUM' argument from the previous command and puts it in the current command. 'NUM'=0 is the command eg. #ls a b c --some output-- # #that is equal to 'ls b'
JesusSuperstar · 487 weeks and 2 days ago
formating messed up the example above eg: ls a b c --some output <ALT><0><.> <ALT><2><.> # is equal to 'ls b' you have to holt the 'Alt' key the whole time.
JesusSuperstar · 487 weeks and 2 days ago
Thanks a lot, that's awesome.
Josay · 487 weeks and 1 day ago
I don't see in which case that's interesting. To make a for loop, simply remplace the command by "*" : for i in *; do somethingWith $i; done
sputnick · 487 weeks and 1 day ago
Sputnick > because it's inserted in your command line, you can add/remove/change elements easily. And pressing 2 keys is faster than remembering the syntax for the for loop.
Josay · 487 weeks and 1 day ago
Excellent!! Thanks for this.
DaveQB · 487 weeks and 1 day ago
It also works with wildcard filtering: echo *.ogg<ESC>* # List *.ogg files echo *w*<ESC>* # List filenames containing 'w'
sunny256 · 487 weeks and 1 day ago
Seems to not work on Fedora 8/Bash
ozymandias · 487 weeks and 1 day ago
@ozymandias What version of bash are you using? Mine is 3.2.39, and it works here.
sunny256 · 487 weeks and 1 day ago
bash --version GNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)
ozymandias · 487 weeks ago
Whoa. Nice. Works fine here, on a gentoo machine .. "GNU bash, version 4.0.17(2)-release (x86_64-pc-linux-gnu)"
Alanceil · 487 weeks ago
Not trying to be a hater, but stuff like this is why I use zsh. In zsh there is no mystery as to how this works, it just does. echo *<TAB> When I'm forced to use bash, I try and make it act like zsh so I can keep my sanity*. So far I've failed :) *says the long time zsh user. But seriously, give it a shot...
claytron · 487 weeks ago
Under bash 3.2.39 I can get echo *.c to work but ls -l *.c does not. Am I doing something wrong?
bwoodacre · 486 weeks and 6 days ago
Same version, same problem. Works : echo * esc-* any_other_command esc-* echo *.c esc-* Does not work : any_other_command *.c esc-* I just can't understand.
Josay · 486 weeks and 5 days ago
Alt * Does the same; I find it easier to type.
polar · 486 weeks and 5 days ago
Work fine on ksh@AIX server ; )
Oxyaxion · 362 weeks and 4 days ago
scream, www.bottega-veneta.us.com or enjoy www.eyeglassframes.in.net the www.christianlouboutinoutlet.net.co cicadas www.coachoutlet-online.com.co flap www.nike.org.es its www.nikeshoesoutlet.org.uk wings www.mcm-bags.in.net when www.michael-kors-outlet-online.us.org you www.air-max.com.de bring www.calvin-kleins.us.com the www.omega-watches.us.com cool www.canada-goosesjackets.us.com wind; www.burberry-outlet.net.co when www.thomas-sabo.com.de passing www.michael-kors-australia.com.au Hasuike www.chiflatiron.net.co also www.giuseppe-zanotti.net puffed www.michaelkorsoutlet-online.ar.com breath www.polooutlets-store.com goods products www.raybans.us.org that www.kate-spade.in.net Lotus www.coach-factoryoutlet.net.co aroma; www.oakleys-sunglasses.us.com hours www.fashionclothes.us.com because uggaustralia.misblackfriday.com ignorance www.ugg-boots.us.org has www.oakleysunglasses-cheap.in.net been www.nike-maxfr.com poked www.hollister-clothing.in.net hornet's www.bcbg-max-azria.ca nest www.michaelkorsoutlet.ar.com and www.burberryonlineshop.de stung www.prada-shoes.com.co his www.bebeclothing.in.net face www.coach-outletonline.net.co was www.nike-free-run.de bruised. www.uggsoutlet.com.co Dig www.hollisters-canada.ca once, www.nikeair--max.fr because www.mcmbags.net "small insects" www.edhardy.us.org (Sparrow) www.pandorajewellery.com.au and www.michael-korshandbags.org.uk took www.maccosmetics.gr.com out www.jordanretro.org a www.ralphlaurenoutlet.us.com "snake" www.tory-burchshoesoutlet.net (Snake) www.ferragamoshoes.in.net scared www.ralphlaurenonlineshop.de to www.chanelhandbags.net.in fall www.uggboots.net.co from supra.shoesoutlet.us.com the www.coach-factoryyoutletonline.net wall. www.timberlands-paschere.fr Fortunately, www.christianlouboutinshoesoutlet.org nothing www.burberry-handbags2016.in.net serious. www.thejoreseproject.com Leisure www.mcmsworldwide.com time, airmax.shoesoutlet.us.com will www.designerhandbagsoutlet.net.co collect www.coach-factory.in.net some www.gucci-taschen-outlet.de cigarette www.chanel-bags.com.co paper www.tomsoutlet-online.com folded www.oakleys-glasses.us.com triangle, www.thenorth-faces.co.uk and www.michael-kors-outlet.us.org partners www.thenorthfacejackets.net.co to www.airhuarache.co.uk play; www.yoga-pants.net.co (the www.adidas.org.es triangle www.cheapuggboots.us.com on www.guccishoes-uk.co.uk the www.tommy-hilfiger-online-shop.de ground and www.cheap-baseballbats.net put www.swarovskicanada.ca his www.burberry2016.co.uk hand www.nikerosherun.us on www.christianlouboutin.org.uk the www.uggs.co.nl ground www.louis-vuittonblackfriday.com quick www.louisvuitton.so photo www.adidas-superstar.de shoot www.nikestore.us the other side www.guccihandbags.net.co of airhuarache.shoesoutlet.us.com the triangle www.rayban.com.de is www.abercrombie-hollister.nl the www.mmoncler-outlet.com triangle www.mizuno-running.net that www.uggboots.com.de turned www.longchamp-handbagsoutlet.us.com their www.omegarelojes.es a); www.swarovskijewelry.com.co and www.vans-schuhe.com.de also www.cheaprayban.com.co than www.uhren-shop.com.de own www.tomsshoes-outlet.us.com older www.designer-handbagsoutlet.us.com brother www.moncler-outlet.us.org and www.nike-schuhe.com.de sister www.tommy-hilfiger-canada.ca were www.abercrombie-fitchs.us.com led www.airjordans.us to a www.poloralphlaurenoutlet.net.co wide www.tommy-hilfiger.co.nl flat www.michaelkors-outlet-online.com.co on the www.burberryoutlet2016.us.com grass www.swarovski--uk.me.uk or www.christian--louboutin.in.net doing www.jordan-shoes.com.co "of www.nike-air-max.com.au chicken" www.bottegaveneta-bagsoutlet.com or www.rolex-watch.me.uk "kill www.rosheruns.us the www.ghd-hairstraightener.net lamb" of www.longchamp.com.de the www.christianlouboutinshoes.jp.net game, www.nikefree5.net before www.guccishoes.com.co the www.pandora.com.de election when www.northfaceoutlet.com.co one www.burberry-outletonlinesale.in.net eagle, www.converse-shoesoutlet.com then www.ralph-laurens.org.uk tall www.guccishoes.in.net in www.louis--vuitton.org.uk front www.horloges-rolex.nl when www.cheapjerseys.com.co hens , www.ralph-lauren.com.au when www.adidas-superstar.nl the www.replica-handbags.net.co rest www.pumaonline-shop.de of www.newbalance.com.es the www.abercrombie-fitchsale.com chicken, www.nike--freerun.co.uk the www.swarovski-online-shop.de eagle www.burberrybags-outlet.com chasing www.coachblackfriday.com shot www.jimmy-choos.com at www.nike-air-max.com.se the www.toms-shoesoutlet.net back www.newoutletonlinemall.com of www.nike-shoesoutlet.us.com the www.hollisteronlineshop.com.de chick, www.burberryoutlet-canada.ca hen with www.prada.com.de open www.abercrombieand-fitch.ca arms www.cheapshoes.com.co to www.prada-handbags.com.co protect www.oakley.com.de chickens, www.juicycouture.com.co smart dodge www.ugg-australia.com.de to www.ralphlaurenpolos.in.net keep www.ralphlaurenoutlet-online.us.com eagle www.longchamps.us.com patting. www.soccer-shoesoutlet.com Or www.louisvuitton-outlet.com.co a www.nike-shoes-canada.ca dozen www.cheapoakley-sunglasses.in.net people www.mkoutletonline.us.com sitting www.rosherun.org.uk in a circle, www.adidasshoes.top do www.abercrombie-and-fitch.us.com a www.eyeglassesonline.us.com do www.converse.net.co Diushou www.adidas.com.se Juan www.hollisterclothingstore.org game: www.uggsaustralia.com.co the www.oakley--sunglasses.com.au hands www.tiffany-andco.us.com of www.polos-ralphlauren.us.com only www.burberrys-outlet.co.uk one www.oakleysunglass-outlet.net person www.p90xworkout.us.com to www.asics-outlet.us.com take www.michael-kors-canada-outlet.ca the handkerchief www.timberlandshoes.net.co out of www.lululemoncanada.ca his airmax.misblackfriday.com mouth www.tiffany-andco.com.au in a www.weddingdressesuk.org.uk circle www.polo-outlets.com.co singing www.ralphlaurenepolo.com Diushou www.rolexwatches-canada.ca Juan www.converse-shoes.net songs, www.nike-air-max.ca danced around www.jimmy-chooshoes.com the www.the-north-face.ca circle www.newbalance-shoes.org turning www.nikefree-run.net quietly www.tnf-jackets.us.com throw www.burberry-outletstore.net the www.burberryoutlet-sale.in.net handkerchief www.air-huarache.co.uk in www.rayban-wayfarer.in.net the www.ugg-boots.ca back of www.ray-ban-outlet.us.com a www.valentino-shoesoutlet.us.com person. www.hermesbags.jp.net Then www.soft-ballbats.com run around www.nike-tnrequinpascher.fr in www.pumashoes.in.net circles. www.airmax-90.org If www.louisvuitton.jp.net you www.louis-vuittonoutletcanada.ca have www.oakley-sunglasses.mex.com a www.thenorthface.com.de lap www.ralphs-lauren.co.uk behind www.nike-roshe-run.de the www.canadagooses-2016.com handkerchief www.cheapjerseys.us.org patting, www.supra-shoes.org this www.yoga-pants.ca people www.hollister-abercrombie.com.se have www.harrods-london.co.uk not www.nikeskos.dk found www.pradahandbags.net.co the www.ralph-laurenoutlet.ca person www.louis-vuitton-taschen.com.de you www.nikefactory.org want www.beats-by-dre.com.co to www.michaelkorsbags.us.org give www.louisvuitton-outlets.us a www.uggs-onsale.net performance www.truereligionjeans.net.co for www.bcbg-dresses.com everyone; www.handbagsoutlet.net.co a www.nikeair-max.es joke, www.coachoutletstore-online.com.co sing www.mcm-handbags.org songs, www.nikefree-run.org.uk or www.truereligion-outlet.us.org back www.newbalance-outlet.org poem. www.longchamphandbagsoutlet.net Then www.new-balance.ca began www.barbour-jacketsoutlet.com Diushou www.lululemon-australia.com.au Juan www.cheap-michaelkors.com by www.nike-skor.com.se him or www.ferragamo.com.co her. www.ugg-uggboots.net If www.coachoutletstore.net.co this www.true-religion.com.co is www.hogan.com.de discovered immediately www.asicsgels.de took www.christian-louboutinshoes.com.co the www.tomsoutletonline.net handkerchief www.nike-airmaxinc.co.uk catch nike.shoesoutlet.us.com Diushou www.toms-shoes.net.co Juan www.basketballshoes.com.co people, www.truereligion-outlet.com.co that www.giuseppezanotti.com.co Diushou www.coco-chanels.us.com Juan www.pulseras-pandora.com.es will www.retro-jordans.com continue www.tommy-hilfiger.com.de to www.tiffany-jewelry.net lose, www.hollister.us.org someone www.pandora-charms-canada.ca who www.cheap-nike-shoes.net can www.tocoachoutlet.com back www.cheapmichaelkors.us.org into www.the-northface.net.co place; www.michaeljordan.com.de catch, www.kate-spade.gb.net and throw www.ray-bansunglasses.net this www.toryburchoutlet-sale.us.com man www.nfl-jersey.us.com who www.woolrich-clearance.com has www.timberlandbootsoutlet.us.com sat www.pradaoutlet.com.co on www.outlet-burberry.net.co the www.pandorajewelry.top bit www.longchamp.com.co when www.louboutin.jp.net this www.salomon-schuhe.com.de man www.rayban.org.es will www.rayban.co.nl be www.toms--outlet.com.co punished www.guccioutlet-sale.in.net performances. www.oakley-outletstore.in.net We www.rayban-sunglassesoutlet.co.uk will www.insanity-workout.us.com play along www.nike-air-force.de with www.uggs.in.net a www.ray--ban.ca dozen www.montres-pascher.fr "Stars www.coach-purseoutlet.net over www.michael--kors.us.com the month child" www.iphone-cases.net.co or www.vans-shoes.co.uk "cat www.vans-shoes.net drilled www.beatsbydre.com.co 72 www.rolex-watches.us.com holes" www.oakley.org.es game. www.ralphlaurenoutletonline.us.org (Read www.replicarolex-watches.us.com the www.oakleyoutlet.ar.com article www.pandora-charms.org.uk Network: www.rolexwatchesforsale.us.com www.sanwen.net)Also I www.christian-louboutin-shoes.ca remember www.burberrys-outlet2016.com one www.barbour-factory.com summer, www.coachhandbags2016.us.com that www.ugg-bootsclearance.com the www.lauren-ralph.co.uk acquisition www.louis-vuitton-australia.com.au of www.beatsbydrdre.co.com medicinal www.instylers.us.com city www.jordanrelease-dates.us.com recovered www.tiffany-und-co.de cicada www.thomas-sabos.org.uk skin www.cheap-jordans.net (medical www.cheapoakley-sunglasses.com term www.ralphlaurenoutletonline.in.net called www.tommy-hilfigeroutlet.com cicada), www.abercrombie-kids.us.com catty www.tiffanyand-co.net.co two www.longchamp-bags.us.com five. www.michaelkors.co.nl So www.michael-kors.net.co every www.tommyhilfigeroutlet.in.net day, www.mk-outlet.us.com together with www.gucci-shoes.net my brothers www.marcjacobs.us.com holding bamboo, www.hermes-outlet.com.co Dianzhe www.reebok.com.de plastic www.tiffanyandco-canada.ca bags, and www.nike-huarache.nl from www.new-balance-schuhe.de the www.michael-kors.com.co village www.polo-ralph-lauren.de in www.marc-jacobs.us.com the www.nike-air-max.us woods www.babyliss-pro.us.com to www.scarpe-hoganoutlets.it find www.zxcoachoutlet.com a www.toryburchsale.com.co tree www.the-northfacejackets.us.com cicada www.michaelkors.so skin, www.wedding--dresses.ca after www.mcmhandbags.com.co the www.ugg-boots-australia.com.au end www.toms-outlets.us.com of www.michaelkors.com.se the www.nikestore.com.de summer, www.michael-kors-taschen.com.de we www.cheap-raybans.com harvest www.raybans-sunglassesoutlet.in.net relatively www.rayban-sunglasses.us.org big, www.ralphlauren-polos.com.co full www.longchampoutlet.com.co harvest www.michaelkorsoutletonline-sale.us.com four pounds, www.michaelkors-uk.org.uk to www.nike-roshe-run.com.es buy www.swarovski-australia.com.au ten dollars. www.replica-watches.com.co The www.airmax-2015.org next www.tommyhilfiger.net.co summer www.soccer-shoes.us.com we look www.michael-kors-handbags.us.com for www.ralphslauren-outlet.co.uk a www.cheap-oakleyglasses.us.com summer, www.nikemercurial.in.net more www.juicycoutureoutlet.net.co than www.levisjeans.com.co the www.converse.com.de first www.louisvuittons.com.co year www.michael-kors.com.es looking www.ralphlauren-polos.co.uk for www.salvatoreferragamo.in.net even www.toms-shoes.com.co more, www.the-northface.com.co I www.gucci-outletstore.com did www.lululemonoutlet.gb.net not www.swarovski-crystal.us.com expect www.nike-air-max.com.de there www.coco-chanel.com.de to www.katespadeoutlet.gb.net happily www.ray-banocchiali.it after www.toryburch-sandals.in.net being www.hermesbirkin-bag.net told www.adidas-schuhe-online.de not www.maccosmetics.net.co recovered. www.montblanc--pens.in.net Cicada www.celine-bags.org got www.oakleyoutlet-online.us.com hard www.chi-flatiron.us.com skin, www.ghdhair-straighteners.co.uk back www.adidas--canada.ca at www.beats-headphone.com.co home www.oakley-sunglasses-canada.ca after www.burberry-handbagsoutlet.com.co shuffling, www.nike-rosherun.nl and www.nike-schoenen.co.nl
zyf543 · 131 weeks and 3 days ago
This only works if bash in in emacs mode. I always work in the vi mode, and there ESC gets you in modal mode. For instance k previous line, and the usual fdcw magic :-)
bartvandeenen · 67 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands



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: