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 command will ask for remote sudo password before executing a remote command.
use .ssh file to login the server
There must be no space between -p and the password
This is just a quick and dirty way to play remote audio files *locally* in your PC.
The best way is to mount the remote Music directory into the local FS, say by using sshfs:
sshfs user@remote:/remote/music/dir/ /mnt/other_pc/
cat didn't seem to work with binaries to well for me, the above command seemed to do the trick.
Opps should be pointed out its going through a "hop" box (which is why I was searching here in first place), only need the last bit (after the -t) if doing it directly from one box to another...
Alternative for machines without ssh-copy-id
Cleaned up and silent with &>/dev/null at the end.
Execute commands serially on a list of hosts. Each ssh connection is made in the background so that if, after five seconds, it hasn't closed, it will be killed and the script will go on to the next system.
Maybe there's an easier way to set a timeout in the ssh options...
Run this within a steady screen session.
You can get the approximate time when the remote server went down or other abnormal behavior.
Copies the complete root-dir of a linux server to another one, where the new harddisks formated and mountet. Very useful to migrate a root-server to another one.
runs the specified ssh command on all chef nodes
This command adds your pem key to SSH so that you no longer have to manually specify it when connecting to EC2 instances.
# you can do this:
# instead of this:
ssh -i ~/.ssh/KEY_PAIR_NAME.pem ec2-instance.amazonaws.com
ssh compresion -C option ...
on slow connection VNC performs better but in local LAN native secure X protocol is an option
if you use tmux and wish to automatically reattach you previously detached sessions when logging in.
Music streaming via ssh
Example: remote install an application(wine).
sshpass -p 'mypssword' ssh -t firstname.lastname@example.org "echo 'mypassword' | sudo -S apt-get install wine"
Tested on Ubuntu.
Use as: $ s host1
Will ssh to remote host upon first invocation. Then use C-a d to detatch. Running "s host1" again will resume the shell session on the remote host. Only useful in LAN environment. You'd want to start the screen on the remote host over a WAN.
Adapted from Hack 34 in Linux Server Hacks 2nd Addition.
ssh port forwading