While logged into ssh, type ~s to see stats of ssh
if you use tmux and wish to automatically reattach you previously detached sessions when logging in.
This will check if a user is logged in using ssh and will log out the user automatically after the specified time in seconds without data retrieval on the server side. Will work with bash and zsh so put it into your sourced shell file on the server side. Be aware that users can change this themselves as it's just a envoronment variable. Show Sample Output
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...
Cleaned up and silent with &>/dev/null at the end. Show Sample Output
Super fast way to ftp/telnet/netcat/ssh/ping your loopback address for testing. The default route 0.0.0.0 is simply reduced to 0. Show Sample Output
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/
There must be no space between -p and the password
Takes a screenshot of x11 and pipes it over ssh to the preview application on a mac. Requires imagemagick on the server side.
Where filein is the source file, destination.com is the ssh server im copying the file to, -c arcfour,blowfish-cbc is selecting the fastest encryption engines, -C is for online compressions and decompression when it comes off the line - supposed to speed up tx in some cases, then the /tmp/fileout is how the file is saved... I talk more about it on my site, where there is more room to talk about this: http://www.kossboss.com/linuxtarpvncssh and http://www.kossboss.com/linux---transfer-1-file-with-ssh Show Sample Output
NOTE: When doing these commands when asked for questions there might be flowing text from the pv doing the progress bar just continue typing as if its not there, close your eyes if it helps, there might be a yes or no question, type "yes" and ENTER to it, and also it will ask for a password, just put in your password and ENTER I talk alot more about this and alot of other variations of this command on my site: http://www.kossboss.com/linuxtarpvncssh Show Sample Output
This is useful when the local machine where you need to do the packet capture with tcpdump doesn?t have enough room to save the file, where as your remote host does tcpdump -i eth0 -w - | ssh savelocation.com -c arcfour,blowfish-cbc -C -p 50005 "cat - > /tmp/eth0.pcap" Your @ PC1 doing a tcpdump of PC1s eth0 interface and its going to save the output @ PC2 who is called save.location.com to a file /tmp/ppp1-to-me.pcap.gz again on PC2 More info @: http://www.kossboss.com/linuxtcpdump1 Show Sample Output
wmr - | pv -s $SIZEOFMEM | ssh -p 40004 -c arcfour,blowfish-cbc -C root@savelocation.com "cat - > /forensics/T430-8gb-RAM1.dd" Run above command from Windows Cygwin: On Windows: Install Cygwin, and copy WMR (windows memory reader 1.0) memory diagnostic into cygwin\bin folder, also install cygwins netcat and ssh (openssh). I recommend installing apt-cyg and running " On Linux: Have an SSH Server SIMPLEST FORM: WINDOWS: # wmr - | ssh root@savelocation.com "cat - > /tmp/FileToSave.dd" For more details on how to extract information from memory dump: apt-get install foremost foremost -t all -T -i /forensics/T430-8gb-RAM1.dd For more information: http://www.kossboss.com/memdump-foremost Show Sample Output
The above is OK if you not worried about security, as per sshpass man pages: " The -p option should be considered the least secure of all of sshpass's options. All system users can see the password in the command line with a simple "ps" command." So, instead what I do is use the -e option: " -e The password is taken from the environment variable "SSHPASS"." Show Sample Output
https://github.com/apenwarr/sshuttle disassembles TCP packets, sends them over SSH, assembles and forwards on the server side, and vice versa.
Forward local UDP port to remotetarget via ssh.
This is the best way to fix this issue on OS X. If you don't have homebrew installed, now is the perfect time to fix that too. ;-) see http://crosstown.coolestguidesontheplanet.com/os-x/40-setting-up-os-x-lion-to-plug-into-homebrew-package-manager Show Sample Output
clush (cluster sh) is a very powerful tool to perform this kind of tests. The [a-b] syntax is expanded by clush. You can also play with names: cn[001-010] expands to cn001, cn002, cn003 .. cn010. Note that does not expands to cn1, cn2, etc., which is very useful, cause normally servers are named cn001, cn002... cn100
This command allows you to mirror folders or files with rsync using a secure SSH channel with a forced HMAC integrity algorithm. Use this if you are absolutely adamant about preserving data integrity while mirroring a set of files. --partial is for resumability.
Useful if localhost is a small machine running BusyBox, which uses a slightly unusual format to set the date. Remotehost can be pretty much any Linux machine, including one running BusyBox. Uses UTC for portability.
Find all private keys and dump their fingerprints. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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
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: