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:
commandline for mac os x
Quick shortcut if you know the hostname and want to save yourself one step for looking up the IP address separately.
remove the host for the .ssh/know_host file
If you have servers on Wide Area Network (WAN), you may experience very long transfer rates due to limited bandwidth and latency.
To speed up you transfers you need to compress the data so you will have less to transfer.
So the solution is to use a compression tools like gzip or bzip or compress before and after the data transfer.
Using ssh "-C" option is not compatible with every ssh version (ssh2 for instance).
This improves on #9892 by compressing the directory on the remote machine so that the amount of data transferred over the network is much smaller. The command uses ssh(1) to get to a remote host, uses tar(1) to archive and compress a remote directory, prints the result to STDOUT, which is written to a local file. In other words, we are archiving and compressing a remote directory to our local box.
The command uses ssh(1) to get to a remote host, uses tar(1) to archive a remote directory, prints the result to STDOUT, which is piped to gzip(1) to compress to a local file. In other words, we are archiving and compressing a remote directory to our local box.
This is also handy for taking a look at resource usage of a remote box.
ssh -t remotebox top
Play local mp3 file on remote machine's speakers through ssh
Creates the .ssh directory on the remote host with proper permissions, if it doesnt exist. Appends your public key to authorized_keys, and verifies it has proper permissions. (if it didnt exist it may have been created with undesireable permissions).
*Korn shell syntax, may or may not work with bash
This one is a bit more robust -- the remote machine may not have an .ssh directory, and it may not have an authorized_keys file, but if it does already, and you want to replace your ssh public key for some reason, this will work in that case as well, without duplicating the entry.
pub key in ./ssh/authorized_keys needed because ssh-ed ssh can't ask for the password.
analyze traffic remotely over ssh w/ wireshark
When using tcpdump, specify -U option to prevent buffering and -iany to see all interfaces.
Create a secure tunnelled connection for access to a remote MySQL database.
For example, connect with MySQL Workbench to email@example.com:13306.
Requires you to have password free login to remote host ;)
Requires xclip and notify-send (If you want to put into clipboard and be notified when action is completed).
DATE=$(date +%Y-%m-%d_%H-%M-%S)-$(($(date +%N)/10000000));
HOST="ssh host of your choice";
DEST="destination folder without trailing slash";
URL="URL for file if uploaded to web enabled dir ie.
import -window root png:- | ssh $HOST "cat > $DEST/screenshot_$DATE.png";
echo $URL | xclip; notify-send -u low "Screenshot Taken" "Entire screen.\nCopied to clipboard"
This command will:
1. open an SSH tunnel to
2. go to background
3. wait for 10 seconds for the connection
4. during the 10 seconds wait it will localy run 'rdesktop' to connect to the remote host through the created SSH tunnel.
Password-less log in can be achieved (when server allows it) by adding '-p ' to the 'rdesktop' command
Now at the end of the rsa.pub file, there is our comment like=