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/
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.
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
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:
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 3 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.
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'
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.
Thanks a lot, that's awesome.
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; doneSputnick > 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.
Excellent!! Thanks for this.
It also works with wildcard filtering:
echo *.ogg<ESC>* # List *.ogg filesecho *w*<ESC>* # List filenames containing 'w'Seems to not work on Fedora 8/Bash
@ozymandias
What version of bash are you using? Mine is 3.2.39, and it works here.
bash --versionGNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)
Whoa. Nice. Works fine here, on a gentoo machine .. "GNU bash, version 4.0.17(2)-release (x86_64-pc-linux-gnu)"
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...
Under bash 3.2.39 I can get echo *.c to work but ls -l *.c does not. Am I doing something wrong?
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.
Alt *Does the same; I find it easier to type.
Work fine on ksh@AIX server ; )