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.

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:



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!

Top Tags



Inserts the results of an autocompletion in the command line

Terminal - Inserts the results of an autocompletion in the command line
2009-06-14 21:17:40
User: Josay
Inserts the results of an autocompletion in the command line

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)


There are 2 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

interesting :)

<ESC> *

returns all the commands in a row.


grabs the 'NUM' argument from the previous command and puts it in the current command. 'NUM'=0 is the command


#ls a b c

--some output--

# #that is equal to 'ls b'

Comment by JesusSuperstar 347 weeks and 1 day ago

formating messed up the example above


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.

Comment by JesusSuperstar 347 weeks and 1 day ago

Thanks a lot, that's awesome.

Comment by Josay 347 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
Comment by sputnick 347 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.

Comment by Josay 347 weeks and 1 day ago

Excellent!! Thanks for this.

Comment by DaveQB 347 weeks and 1 day ago

It also works with wildcard filtering:

echo *.ogg<ESC>* # List *.ogg files echo *w*<ESC>* # List filenames containing 'w'
Comment by sunny256 347 weeks ago

Seems to not work on Fedora 8/Bash

Comment by ozymandias 347 weeks ago


What version of bash are you using? Mine is 3.2.39, and it works here.

Comment by sunny256 347 weeks ago
bash --version

GNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)

Comment by ozymandias 347 weeks ago

Whoa. Nice. Works fine here, on a gentoo machine .. "GNU bash, version 4.0.17(2)-release (x86_64-pc-linux-gnu)"

Comment by Alanceil 347 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...

Comment by claytron 347 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?

Comment by bwoodacre 346 weeks and 5 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.

Comment by Josay 346 weeks and 4 days ago
Alt *

Does the same; I find it easier to type.

Comment by polar 346 weeks and 4 days ago

Work fine on ksh@AIX server ; )

Comment by Oxyaxion 222 weeks and 3 days ago

Your point of view

You must be signed in to comment.