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.
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:
I have this on a daily cronjob to backup the commandlinefu.com database from NearlyFreeSpeech.net (awesome hosts by the way) to my local drive. Note that (on my Ubuntu system at least) you need to escape the % signs on the crontab.
Have you ever had to scp a file to your work machine in order to copy its contents to a mail? xclip can help you with that. It copies its stdin to the X11 buffer, so all you have to do is middle-click to paste the content of that looong file :)
I use this all the time for taking manual backups of stuff i want to keep but not important enough to backup regularly.
This option makes a copy of your current db and via ssh it transfer to the server you specify and upload the database to the specific User & Password you specify (Note the db User & Pass, can be different from the one you use in the other server)
If you are going to use "localhost" as your main db remove (-h) and youst add "localhost"
Dumps a MySQL database over a compressed SSH tunnel and uses it as input to mysql - i think that is the fastest and best way to migrate a DB to a new server!
Simply change your web browser's proxy settings to point to a SOCKS proxy at port 8888 and you're good to go.
Should run on any system with ssh installed.
Foward vnc securely from exampleserver.com
Just run the command, type your password, and that's the last time you need to enter your password for that server.
This assumes that the server supports publickey authentication. Also, the permissions on your home dir are 755, and the permissions on your .ssh dir are 700 (local and remote).
waste the band width
This will output the sound from your microphone port to the ssh target computer's speaker port. The sound quality is very bad, so you will hear a lot of hissing.
Creates a quick backup with tar to a remote host over ssh.
this is handy when the hubmachine is the only machine that can connect to the destination machine (allowed on ip by firewall) and you want to access it from your laptop.
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.
...can do similar w/ tar, dd, xfsdump, e2fsdump, etc.
vimdiff to remotehost
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.
Ping machine once, waiting 1 second for response until failing. Upon fail, ssh globally, otherwise ssh locally.