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:
This uses ssh to transfer the contents of one Mac's clipboard to another's. This only works with plain text, sadly. Trying to transfer images will just clear out the remote machine's clipboard, and rich text will be converted to plain text. Using the "Remote Login" must be enabled on the remote machine (via System Preferences' Sharing panel) for this to work.
This version compresses the data for transport.
In the example above 3 tables are copied. You can change the number of tables. You should be able to come up with variants of the command by modifying the mysqldump part easily, to copy some part of remote mysql DB.
This may be listed already but this command is useful to untar a specific directory to a different server.
If you are stuck behind a firewall and want to synchronize time with another server but you do not want to port forward NTP (which uses UDP) then this command is handy. It gets the time from a server and sets the local time. It is not that accurate but I can live with a second or so drift.
Run local scripts on remote server. "-T Disable pseudo-tty allocation"
1. SSH into a machine
2. Tunnels VNC port to your local computer ("-L 5900:localhost:5900")
3. Runs a single use vnc server ("x11vnc -safer -localhost -nopw -once -display :0")
4. Goes into the background ("-f")
5. Runs VNC viewer on the local computer connecting to the remote machine via the newly created SSH tunnel ("vinagre localhost:5900")
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.
This command will copy command's output into your local clipboard
- port 8080 on localhost will be a SOCKSv5 proxy
- at localhost:localport1 you will be connected to the external source server1:remoteport1 and at bind_address2:localport2 to server2:remoteport2
- you will be using only IPv4 and arcfour/blowfish-cbc, in order to speed up the tunnel
- if you lose the connection, autossh will resume it at soon as possible
- the tunnel is here a background process, wiithout any terminal window open
When debugging an ssh connection either to optimize your settings ie compression, ciphers, or more commonly for debugging an issue connecting, this alias comes in real handy as it's not easy to remember the '-o LogLevel=DEBUG3' argument, which adds a boost of debugging info not available with -vvv alone.
Especially useful are the FD info, and the setup negotiation to create a cleaner, faster connection.
When using tcpdump, specify -U option to prevent buffering.
This version transfers gzipped data which is unzipped as it arrives at the remote host.
use this command via ssh on remote machine when you want play video
remove --directory if you want select single file
use this command via ssh on remote machine when you want play video stream or path to file
~ is the ssh control character. If you type it after a newline, you can example force close the ssh session.
, ~, then .
If you want more info, type ~? when you are connecting using ssh.
Very useful to kill of any hanging ssh sessions when nothing else works.
The pee command is in the moreutils package.
Do the same as pssh, just in shell syntax.
Put your hosts in hostlist, one per line.
Command outputs are gathered in output and error directories.
This command will download $file via server. I've used this when FTP was broken at the office and I needed to download some software packages.
Ever wanted to stream your favorite podcast across the network, well now you can.
This command will parse the iTunes enabled podcast and stream the latest episode across the network through ssh encryption.
Stream OGG vorbis over ssh.