SSH & Screen: Cheat sheet & tips for use with the command line (CLI)

My cheat sheet for SSH and screen...

SSH is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers.

Screen is an application that can be used to run multiple virtual terminal consoles. It allows a user to access multiple separate terminal sessions inside a single terminal window or remote (SSH) terminal session. 


SSH
Start SSH from command line terminal using public / private keys:
ssh -2 -l username hostname -v -p port -i privatekeypath
where -l is low case L for login

Screen
Start screen: 
screen -S chooseasessioname


List screens:
screen -list


Reconnect to a screen:
screen -d -r sessionowner/[pid.tty.host]
or
screen -d -r thesessionname

Commands once in screen
Ctrl-a         - escape
Ctrl-a-d     - detach the screen and all windows
Ctrl-a-c     - new terminal window
Ctrl-a 0-9  - swap terminal window
Ctrl-a a      - swap to last window
Ctrl-a-\       - kill the screen and all windows
Ctrl-a D D - detach log out of screen and close the ssh session



Share a screen
Ctrl-a :multiuser on

screen -x thesessionname

No comments:

Post a Comment