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





Maintained by Jon H.

Site originally by David Winterbottom (user root).

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

Commands using ssh-keygen from sorted by
Terminal - Commands using ssh-keygen - 25 results
ssh-keygen -b 4048 -t rsa -C "comment"
2016-02-03 09:37:39
User: erez83
Functions: ssh ssh-keygen
Tags: ssh centos

Generating ssh key

then need to copy public key in to /root/.ssh/authorized_keys

ssh-keygen -t rsa -b 4096 -f ~/.ssh/<ROLE>_rsa -C "Comment goes here"
2015-01-11 17:52:21
User: krizzo
Functions: ssh ssh-keygen
Tags: ssh-keygen

This is just a default ssh-keygen command. Prompts for a password that you can use to secure the keys more and uses a higher bit value than the default along with naming the key something other than id_rsa for better file identification.

for id in `ls -1 ~/.ssh | grep -v "authorized\|known_hosts\|config\|\."` ; do echo -n "$id: " ; ssh-keygen -l -f .ssh/$id ; done
2014-04-16 14:12:20
User: drockney
Functions: echo grep id ssh-keygen

Find all private keys and dump their fingerprints.

diff <(ssh-keygen -y -f ~/.ssh/id_rsa) <(cut -d' ' -f1,2 ~/.ssh/id_rsa.pub)
ssh-keygen -l -f [pubkey] | cut -d ' ' -f 2 | tr -ds '\n:' ''
for HOSTTOREMOVE in $(dig +short host.domain.tld); do ssh-keygen -qR $HOSTTOREMOVE; done
ssh-keygen -R $(dig +short host.domain.tld)
2012-01-19 15:08:50
User: atoponce
Functions: dig ssh ssh-keygen

Quick shortcut if you know the hostname and want to save yourself one step for looking up the IP address separately.

ssh-keygen -R <thehost>
ssh-keygen -C hello@world
2011-07-06 18:02:32
User: aykut
Functions: ssh ssh-keygen

Now at the end of the rsa.pub file, there is our comment like=

".................peXeuE0ytJgpQcXeR5aHlfLa8dAt0obasd hello@world"

ssh-keygen ptaduri@c3pusas1
ssh-keygen -R hostname
ssh-keygen -l -f ~/.ssh/known_hosts
2010-12-05 04:03:07
User: atoponce
Functions: ssh ssh-keygen
Tags: ssh

Will return the SSH server key information for each host you have in your ~/.ssh/known_hosts file, including key size, key fingerprint, key IP address or domain name, and key type.

ssh-keygen -f ~/.ssh/id_rsa -p
2010-07-19 12:53:35
User: darkfader
Functions: ssh ssh-keygen

Protects your secret identity with a passphrase.

OSX 10.6 automatically does key forwarding and can store the passphrase in the keychain.

For other OSes, use ssh -A or set ForwardAgent in ssh_config to enable forwarding. Then use ssh-agent/ssh-add.

ssh-keygen -R <the_offending_host>
2010-07-11 19:37:24
User: bunam
Functions: ssh ssh-keygen
Tags: sed

In this case it's better do to use the dedicated tool

echo 'Host or User@Host?:'; read newserver && ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa ; ssh $newserver cat <~/.ssh/id_rsa.pub ">>" ~/.ssh/authorized_keys ; ssh $newserver
2010-05-07 06:24:53
User: alf
Functions: cat echo read ssh ssh-keygen
Tags: ssh ssh-keygen

Some servers don't have ssh-copy-id, this works in those cases.

It will ask for the destination server, this can be IP, hostname, or user@hostname if different from current user.

Ssh keygen will let you know if a pubkey already exists on your system and you can opt to not overwrite it.

ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates
2010-01-29 19:35:21
User: eastwind
Functions: ssh ssh-keygen

this command test the moduli file generated by the command ssh-keygen -G /tmp/moduli-2048.candidates -b 2048 . The test can be long depend of your cpu power , around 5 minutes to 30 minutes

ssh-keygen -G /tmp/moduli-2048.candidates -b 2048
2010-01-29 19:33:23
User: eastwind
Functions: ssh ssh-keygen

if you lost your moduli file in openssh server side you need generate new one with this command then test if the number generated can be used with ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates

ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub && ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub
2009-10-26 17:52:41
Functions: ssh ssh-keygen
Tags: ssh bash

Get your server's fingerprints to give to users to verify when they ssh in. Publickey locations may vary by distro. Fingerprints should be provided out-of-band.

ssh-keygen -R `host hostname | cut -d " " -f 4`
2009-09-23 14:58:28
User: flart
Functions: cut hostname ssh ssh-keygen

Quick shortcut if you know the hostname and want to save yourself one step for looking up the IP address separately.

ssh-keygen; ssh-copy-id user@host; ssh user@host
2009-03-18 07:59:33
User: bwoodacre
Functions: ssh ssh-keygen
Tags: openssh

This command sequence allows simple setup of (gasp!) password-less SSH logins. Be careful, as if you already have an SSH keypair in your ~/.ssh directory on the local machine, there is a possibility ssh-keygen may overwrite them. ssh-copy-id copies the public key to the remote host and appends it to the remote account's ~/.ssh/authorized_keys file. When trying ssh, if you used no passphrase for your key, the remote shell appears soon after invoking ssh user@host.

ssh-keygen -l -f [pubkey] | awk '{print $2}' | tr -ds ':' '' | egrep -ie "[a-f0-9]{32}"
ssh-keygen -i -f $sshkeysfile >> authorized_keys
ssh-keygen -R \[localhost\]:8022
2009-02-05 11:48:09
User: Sekenre
Functions: ssh ssh-keygen

Useful if you have to tunnel ssh through a local port and it complains of the host key being different. Much easier than manually editing the file.