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

Place the argument of the most recent command on the shell

Terminal - Place the argument of the most recent command on the shell
'ALT+.' or '<ESC> .'
2009-03-20 11:36:04
User: atoponce
311
Place the argument of the most recent command on the shell

When typing out long arguments, such as:

cp file.txt /var/www/wp-content/uploads/2009/03/

You can put that argument on your command line by holding down the ALT key and pressing the period '.' or by pressing <ESC> then the period '.'. For example:

cd 'ALT+.'

would put '/var/www/wp-content/uploads/2009/03/ as my argument. Keeping pressing 'ALT+.' to cycle through arguments of your commands starting from most recent to oldest. This can save a ton of typing.

Alternatives

There are 11 alternatives - vote for the best!

Terminal - Alternatives
<ESC> .
<ALT> .
<ALT>+<.> or <ALT>+<NUM>+<.> or <ALT>+<NUM>,<ALT>+<.>
2011-03-01 17:41:08
User: aikikode
12

After executing a command with multiple arguments like

cp ./temp/test.sh ~/prog/ifdown.sh

you can paste any argument of the previous command to the console, like

ls -l ALT+1+.

is equivalent to

ls -l ./temp/test.sh

ALT+0+. stands for command itself ('ls' in this case)

Simple ALT+. cycles through last arguments of previous commands.

<Esc> _
2011-03-07 10:06:46
User: homburg
6

This works if your terminal is in Vi mode

<alt+.>

Know a better way?

If you can do better, submit your command here.

What others think

hmm, remarkably similar to:

http://www.commandlinefu.com/commands/view/1545/gets-the-last-string-of-previous-command-with-

Comment by mpb 409 weeks and 1 day ago

Doesn't seem to work for me, they both just re-input what I just typed -- from the same line.

Comment by ozymandias 409 weeks and 1 day ago

@mpb Except that I don't require the use of the shift modifier. Further, comments don't get as high attention as a newly submitted command.

@ozymandias If your previous command didn't have an argument, then it will just place the previous command on the line.

Comment by atoponce 409 weeks and 1 day ago

atoponce -- that's what I tested...

Comment by ozymandias 408 weeks and 1 day ago

Only 'ESC+.' works for me.

Comment by bwoodacre 403 weeks and 3 days ago

Make sure you're holding Alt while pressing period. If you press . again it will go back in history too. If only Esc . works for you, you need to set your terminal to send meta as escape.

Comment by rkulla 353 weeks and 4 days ago

Only Escape + . works for me in Terminal on a Mac.

Comment by erikhansen 350 weeks and 2 days ago

In Vi mode:

<Esc> _

Or to choose arg and _ to activate:

<Alt>+<num>, _
Comment by homburg 306 weeks and 5 days ago

You can also use the numeric prefix to adjust the argument from the previous command which will be used.

In bash, the numeric prefix is Esc (\e below) followed by any number of digits, and the modifier counts parameters from the start, with \e0\e. giving you the command itself, \e2\e. the second parameter.

In zsh, the numeric prefix is extended by \e single-digit, so to pass in 12 it's \e1\e2. For \e. zsh counts backwards with 1 being the *last* parameter, so that \e. and \e1\e. are equivalent. This makes sense, since the numeric prefix is conceptually a repetition count. Except that zsh then makes \e0\. get the command position, same as bash.

Still both useful. Add in on zsh:

zle -N copy-earlier-word bindkey '^[,' copy-earlier-word

and you have \e, to copy the previous word from the *current* command-line, and numeric prefices upon that, and the ability to mess around with long paths gets much easier.

Comment by syscomet 244 weeks ago

You can also use $_ in BASH. Good for scripts. :)

Comment by somaddict 218 weeks and 2 days ago

works on my machine, running Gnome 2 on Debian.

Comment by sandcurves 214 weeks ago

Ok, pressing . gives me older and older commands, but what if I go too far, ans would like to cycle forward?

Comment by unixmonkey63146 181 weeks and 2 days ago

Can anyone help with the Vi-mode version

<Esc> _

doesn't seem to work for me.

Comment by crashandburn4 149 weeks and 1 day ago

the ALT "." command has become one of the biggest time savers I've ever used w/the added benifit of a little less risk than using some other similar options. This, and `sudo !!` have saved me lots of time. But "." is the cats meow.

Comment by substdio 146 weeks and 6 days ago

Individuals make use of discount carry bags for several needs, for instance having clothing, goods or even a notebook. These kinds of bags certainly are a required a part of daily life for many individuals if they proceed to the retail store, institution as well as operate. Bags therefore are perfect for adding ones discount graphics, mail messages and types.The carry bags advertising can be considered since strolling advertisements for corporations. The reason being your clients could possibly put on or carry the bags in which they are going. This allows ones print to be open in such spots since airfields, offices, educational facilities, shopping malls, gyms, areas and so forth. It will cost almost no to offer the graphics, communications in addition to brand around the discount tote bags however the dividends are going to be massive.You can discover tailor made advertising bags in addition to totes in various charges geared to almost any spending budget reserve for marketing applications. The actual bags are made from economical supplies. It is possible to as a result disperse all of them since reward bags without worrying in regards to the valuation on getting them to created in public. You can utilize the actual bags for almost any discount campaign that you've organized.The advertising bags and also http://www.hermesbeltsbirkinkellybag.co.uk/ bags can be produced associated with eco-friendly material, which in turn helps to ensure that your small business remains to be environmentally concerned from the view of the shoppers. This bags are therefore recycleable because of their re-cycled organic supplies. Some of the most popular marketing bags incorporate customized handbag bags, duffel bags in addition to health and fitness center bags, drawstring bags, meal bags refrigerators, courier bags, in addition to briefcases and affixes, promo plastic-type material bags, luggage and travel bags, newspaper buying bags, reward bags, along with notebook computer in addition to laptop or computer bags.You can locate promotional handbag bags created from cotton goose, 100 % cotton, non-woven polypropylene unwoven hand bags. Its high-end, bright floor increases the bags a terrific seem that is certainly typically affecting recyclable, eco-friendly bags.Promotional totes are created using shock absorbing coated air conditioning product as well as computer sleeves. You could find bags set for usage by the pool. They already have zips that will end mud coming from going into. Alternatively, you have access to bags which might be offered to agree to overflow of things. You can purchase your carrier bag promo in assorted sizes. More substantial bags can offer retractable grips and also moving tires regarding less complicated freedom. Advertising bags can be found in long lasting supplies to safeguard these individuals through usage on account of running.Tote bags promotional are available in a range of colors and designs. The bags might be custom made to fit your price range. This really is with regards to specific things like the content, measurement, graphics and design. Ones bags can act as your ambassadors considering the fact that 68% of people that view the brand about the bags will end up transacting company along. 53% involving visitors will experience a confident mindset to your model that you're featuring.The indisputable fact that promo carriers tend to be popular makes them an ideal weapon to work with with regards to your opponents endeavors. Their attributes get them to suitable for marketing and advertising. These are powerful and hard. As a result, they provide good advertising worth ultimately. The range of hues lets you enhance your brand. Thus, you will receive great company id.

Comment by stephanieg915 5 days ago

http://www.canadagoosefemmehomme2016.fr/femme-canadian-goose_104.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-femme-occasion_164.html

http://www.canadagoosefemmehomme2016.fr/parka-canada-goose-homme-pas-cher_419.html

http://www.canadagoosefemmehomme2016.fr/palliser-canada-goose_261.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-montebello-parka_81.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-homme-pas-cher_440.html

http://www.canadagoosefemmehomme2016.fr/bonnet-canada-goose_289.html

http://www.canadagoosefemmehomme2016.fr/mystique-canada-goose_343.html

http://www.canadagoosefemmehomme2016.fr/doudoune-style-canada-goose_283.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-luxembourg_51.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-france-boutique_218.html

http://www.canadagoosefemmehomme2016.fr/survetement-canada-goose_356.html

http://www.canadagoosefemmehomme2016.fr/parka-citadel-canada-goose_253.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-pas-cher_192.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-montebello_383.html

http://www.canadagoosefemmehomme2016.fr/parajumpers-ou-canada-goose_87.html

http://www.canadagoosefemmehomme2016.fr/prix-d-une-canada-goose-au-canada_175.html

http://www.canadagoosefemmehomme2016.fr/kensington-parka-canada-goose_257.html

http://www.canadagoosefemmehomme2016.fr/vetement-canada-goose_368.html

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

http://www.canadagoosefemmehomme2016.fr/prix-canada-goose-enfant_75.html

Comment by sguerra376 2 days ago

http://www.canadagoosefemmehomme2016.fr/parka-trillium-canada-goose_333.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chateau-pas-cher_173.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-site_385.html

http://www.canadagoosefemmehomme2016.fr/parka-canada-goose-pas-cher_358.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-femme-prix_231.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-femme-occasion_262.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-kaki_251.html

http://www.canadagoosefemmehomme2016.fr/trillium-parka-canada-goose_108.html

http://www.canadagoosefemmehomme2016.fr/selkirk-canada-goose_77.html

http://www.canadagoosefemmehomme2016.fr/forum-canada-goose_60.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-original_190.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chilliwack-femme_191.html

http://www.canadagoosefemmehomme2016.fr/manteau-canada-goose-prix_332.html

http://www.canadagoosefemmehomme2016.fr/constable-parka-canada-goose_97.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-enfant_83.html

http://www.canadagoosefemmehomme2016.fr/prix-d-une-canada-goose-au-canada_175.html

http://www.canadagoosefemmehomme2016.fr/survetement-canada-goose_356.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-chilliwack-femme_473.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-vente_95.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-femme-rouge_59.html

http://www.canadagoosefemmehomme2016.fr/ou-acheter-canada-goose_100.html

Comment by sguerra376 2 days ago

http://www.canadagoosefemmehomme2016.fr/manteau-canada-goose-enfant_405.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chateau-pas-cher_173.html

http://www.canadagoosefemmehomme2016.fr/casquette-canada-goose_134.html

http://www.canadagoosefemmehomme2016.fr/forum-canada-goose_60.html

http://www.canadagoosefemmehomme2016.fr/doudoune-femme-canada-goose_103.html

http://www.canadagoosefemmehomme2016.fr/vrai-canada-goose-pas-cher_40.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-resolute_66.html

http://www.canadagoosefemmehomme2016.fr/borden-canada-goose_442.html

http://www.canadagoosefemmehomme2016.fr/acheter-une-canada-goose_177.html

http://www.canadagoosefemmehomme2016.fr/yorkville-canada-goose_463.html

http://www.canadagoosefemmehomme2016.fr/skreslet-parka-canada-goose_469.html

http://www.canadagoosefemmehomme2016.fr/femme-canadian-goose_104.html

http://www.canadagoosefemmehomme2016.fr/manitoba-canada-goose_482.html

http://www.canadagoosefemmehomme2016.fr/site-officiel-canada-goose_432.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-veste_126.html

http://www.canadagoosefemmehomme2016.fr/blouson-aviateur-canada-goose_299.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-grise-femme_269.html

http://www.canadagoosefemmehomme2016.fr/femmes-canada-goose_281.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chilliwack-bomber-femme_458.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-fr_53.html

http://www.canadagoosefemmehomme2016.fr/logo-canada-goose_138.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-fourrure-coyote_244.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chilliwak_109.html

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

http://www.canadagoosefemmehomme2016.fr/parka-trillium-canada-goose_333.html

http://www.canadagoosefemmehomme2016.fr/doudoune-style-canada-goose-femme_388.html

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

Comment by sguerra376 1 day ago

www.canadagoosefemmehomme2016.fr/jogging-canada-goose_399.html

www.canadagoosefemmehomme2016.fr/doudoune-canada-goose_330.html

www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-d-occasion_466.html

www.canadagoosefemmehomme2016.fr/survetement-canada-goose_356.html

www.canadagoosefemmehomme2016.fr/vente-canada-goose_194.html

www.canadagoosefemmehomme2016.fr/canada-goose-pour-enfant_217.html

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

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

www.canadagoosefemmehomme2016.fr/blouson-aviateur-canada-goose_299.html

www.canadagoosefemmehomme2016.fr/doudoune-goose-canada_292.html

www.canadagoosefemmehomme2016.fr/canada-goose-pas-cher-paris_354.html

www.canadagoosefemmehomme2016.fr/blouson-canada-goose-homme_467.html

www.canadagoosefemmehomme2016.fr/leboncoin-canada-goose_481.html

www.canadagoosefemmehomme2016.fr/canada-goose-grise-femme_269.html

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

www.canadagoosefemmehomme2016.fr/parka-canada-goose-prix_395.html

www.canadagoosefemmehomme2016.fr/canada-goose-site-officiel_57.html

www.canadagoosefemmehomme2016.fr/canada-goose-en-suisse_89.html

www.canadagoosefemmehomme2016.fr/destockage-canada-goose_286.html

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

www.canadagoosefemmehomme2016.fr/parka-canada-goose-chateau_400.html

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

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

www.canadagoosefemmehomme2016.fr/canada-goose-site-fiable_136.html

www.canadagoosefemmehomme2016.fr/canada-canada-goose_246.html

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

Comment by sguerra376 1 day ago

http://www.canadagoosefemmehomme2016.fr/canada-goose-original_190.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-magasin_239.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-toulouse_459.html

http://www.canadagoosefemmehomme2016.fr/revendeur-canada-goose-france_401.html

http://www.canadagoosefemmehomme2016.fr/blouson-canada-goose-homme_467.html

http://www.canadagoosefemmehomme2016.fr/citadel-parka-canada-goose_62.html

http://www.canadagoosefemmehomme2016.fr/veste-canada-goose-homme_474.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-foxe_91.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-d-occasion_466.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-new-york-price_202.html

http://www.canadagoosefemmehomme2016.fr/snow-mantra-canada-goose_155.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-hybridge_344.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-site-fiable_136.html

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

http://www.canadagoosefemmehomme2016.fr/magasin-canada-goose-france_216.html

http://www.canadagoosefemmehomme2016.fr/manitoba-canada-goose_482.html

http://www.canadagoosefemmehomme2016.fr/yukon-bomber-canada-goose_147.html

http://www.canadagoosefemmehomme2016.fr/pantalon-canada-goose_315.html

http://www.canadagoosefemmehomme2016.fr/manteau-canada-goose-femme-pas-cher_472.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-blouson-aviateur-chilliwack-homme_321.html

Comment by sguerra376 1 day ago

http://www.canadagoosefemmehomme2016.fr/canada-goose-parka-montebello_317.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-kensington-parka-femme_448.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-femme_68.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-homme-prix_243.html

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

http://www.canadagoosefemmehomme2016.fr/heatherton-canada-goose_484.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-mountaineer_477.html

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

http://www.canadagoosefemmehomme2016.fr/canada-goose-dawson-parka_374.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-d-occasion_466.html

http://www.canadagoosefemmehomme2016.fr/boutique-canada-goose-france_117.html

http://www.canadagoosefemmehomme2016.fr/acheter-canada-goose-paris_406.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-femme-victoria_285.html

http://www.canadagoosefemmehomme2016.fr/heli-arctic-canada-goose_441.html

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

http://www.canadagoosefemmehomme2016.fr/canada-goose-lyon_237.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-aviateur_449.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-paris_144.html

http://www.canadagoosefemmehomme2016.fr/parka-femme-canada-goose_336.html

http://www.canadagoosefemmehomme2016.fr/veste-canada-goose-solde_198.html

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

http://www.canadagoosefemmehomme2016.fr/manteau-canada-goose-femme-pas-cher_472.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-new-york-prix_159.html

Comment by sguerra376 1 day ago

http://www.canadagoosefemmehomme2016.fr/canada-goose-point-de-vente_371.html

http://www.canadagoosefemmehomme2016.fr/prix-d-une-canada-goose-au-canada_175.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-site-officiel_188.html

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

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

http://www.canadagoosefemmehomme2016.fr/canada-goose-expedition_268.html

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

http://www.canadagoosefemmehomme2016.fr/veste-style-canada-goose_223.html

http://www.canadagoosefemmehomme2016.fr/resolute-canada-goose_116.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-bleu-electrique_187.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-metz_445.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-a-vendre_404.html

http://www.canadagoosefemmehomme2016.fr/adresse-magasin-canada-goose-montreal_297.html

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

http://www.canadagoosefemmehomme2016.fr/manteau-canada-goose-enfant_405.html

http://www.canadagoosefemmehomme2016.fr/whistler-parka-canada-goose_309.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-resolute_66.html

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

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

http://www.canadagoosefemmehomme2016.fr/femme-canadian-goose_104.html

http://www.canadagoosefemmehomme2016.fr/goose-canada-femme_476.html

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

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-france_265.html

Comment by sguerra376 18 hours ago

Your point of view

You must be signed in to comment.