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.

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

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands tagged shortcut from sorted by
Terminal - Commands tagged shortcut - 11 results
bind -P | grep -v "is not" | sed -e 's/can be found on/:/' | column -s: -t
2013-12-19 12:30:19
User: leni536
Functions: column grep sed
0

Shows all available keyboard bindings in bash. Pretty printing.

ctrl-x ctrl-x
telnet 0 <port>
2012-11-16 03:38:49
User: somaddict
Functions: telnet
0

Super fast way to ftp/telnet/netcat/ssh/ping your loopback address for testing. The default route 0.0.0.0 is simply reduced to 0.

stty -ixon
2012-05-28 19:04:19
User: ricardofunke
Functions: stty
1

This command disable sending of start/stop characters.

It's useful when you want to use incremental reverse history search forward shortcut (Ctrl+s).

To enable again, type:

stty -ixoff
bind -P
2012-05-28 18:51:59
User: ricardofunke
38

This command shows the various shortcuts that can be use in bash, including Ctrl+L, Ctrl+R, etc...

You can translate "\C-y" to Ctrl+y, for example.

pkill -{signal} mpg321
2011-11-23 12:11:02
User: neurignacio
0

useful signals are:

pkill -SIGSTOP mpg321 #pause pkill -SIGCONT mpg321 #resume pkill -SIGHUP mpg321 #stop pkill -SIGKILL mpg321 #force exit

TIP: use aliases or shortcuts to control mpg321 from the Desktop Manager

scp filename root@remote:`pwd`
2011-10-29 07:12:17
User: shadus
Functions: scp
3

This will copy a file from your current directory to the same location on another machine. Handy for configuring ha, copying your resolv.conf, .bashrc, anything in /usr/local, etc.

<ESC> #
2011-09-13 17:01:44
User: ioggstream
6

This should work with different locales. Another post reports

<Alt-Shift-#>
alias s='ssh -l root'
2009-05-07 15:57:12
User: GouNiNi
Functions: alias
-20

When you have to manage lot of servers, it's boring to type ssh root@myhost for each connection. Now you can type juste "s someting" and you are connected.

You can too add bash_completion script to complet with tab the name of your servers. This will be the next tips from me ;)

svn status app/models/foo.rb; svn commit -m "Changed file" !$
2009-03-22 23:14:06
User: ggoodale
-4

After a command is run in bash, !$ is set to the last (space-delimited) argument of the command. Great for running several commands against the same file in a row.