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.

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



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

Copy ssh keys to [email protected] to enable password-less ssh logins.

Terminal - Copy ssh keys to [email protected] to enable password-less ssh logins.
$ssh-copy-id [email protected]
2009-02-07 04:58:11
User: senthil
Copy ssh keys to [email protected] to enable password-less ssh logins.

To generate the keys use the command ssh-keygen


There are 6 alternatives - vote for the best!

Terminal - Alternatives
ssh-copy-id [email protected]
cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
2009-02-05 19:37:56
User: DEinspanjer
Functions: cat ssh

If you use Mac OS X or some other *nix variant that doesn't come with ssh-copy-id, this one-liner will allow you to add your public key to a remote machine so you can subsequently ssh to that machine without a password.

ssh-copy-id [email protected]
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
ssh-copy-id host
2012-07-24 08:43:41
Functions: ssh

If the username on the remote host is the same as on the local machine you can omit the username.

Know a better way?

If you can do better, submit your command here.

What others think

If you need change default port ssh, you can use:

ssh-copy-id [email protected] -p2233'

Comment by irraz 401 weeks and 1 day ago

I think this isn't normally found outside Ubuntu or Debian systems.

Comment by mlambie 400 weeks and 3 days ago

Alternativly you can use ?cat ~/.ssh/*.pub | ssh [email protected] 'umask 077; cat >>.ssh/authorized_keys'? on such systems.

Comment by DASKAjA 400 weeks and 3 days ago

... without the question marks (?) of course.

Comment by DASKAjA 400 weeks and 3 days ago

Beware : without arguments it copies your identity.pub file, which is by default a RSA1 pub key (obsolete), unless you have already executed ssh-agent, added your keys, so that ssh-add -L returns something.

Comment by jmcoursi 400 weeks ago

Works on RedHat-like systems

Comment by jmcoursi 400 weeks ago

Also works on Gentoo, it's contained in openssh package.

Comment by xupeng 398 weeks and 5 days ago

doesn't work across all unix OS. Or is there some installation needed?

Comment by rommelsharma 397 weeks and 6 days ago
cat ~/.ssh/id_dsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys
Comment by juddmaltin 395 weeks and 3 days ago

ssh-copy-id is just a script. If you don't have it you can google it easily ehough. Using the above cat is easier though. OS X doesn't bundle ssh-copy-id so I always use the cat version.

Comment by qubyte 394 weeks and 3 days ago

This does not work on CentOS 5.3:

ssh-add -L

The agent has no identities.

So, this tip requires at least some readme on setting up said ssh-copy-id

Quick reading of man ssh-agent did not result in much enlightenment for me.

On the other hand the

cat ~/.ssh/*.pub | ssh [email protected] 'umask 077; cat >>.ssh/authorized_keys'

is easy to understand and certainly works....

Comment by vleolml 388 weeks and 3 days ago

vleolml, ssh-copy-id does exist on both Ubuntu 8.x and CentOS 5.x.

Comment by bassu 381 weeks and 5 days ago

As always, read the man page carefully before using this command. It does a bit more than just copying your public key. It also modifies the permissions of ~ and ~/.ssh, which may not be what you want if for example the recipient of your key is user postgres on the remote box.

Comment by lorenzocabrini 315 weeks and 5 days ago

For OSX using Homebrew: there is a Formula for this: http://mxcl.github.com/homebrew/

Comment by unixmonkey24450 271 weeks ago

thanks man this will help me :)

Comment by techie 184 weeks and 3 days ago

Your point of view

You must be signed in to comment.