The
screen
command is a very useful command that provides the ability to use multiple shell windows (sessions) from a single SSH session. When a session is detached or the network is disconnected, processes initiated within the
screen
session will continue to run, and you can reconnect to the screen
session at any time.Install
apt-get -y install screen
Parameters
screen -S session_name # Create a new session named session_name screen -ls (or screen -list) # List all the current sessions screen -r session_name # Return to the session named session_name screen -d session_name # Detach a particular session remotely screen -d -r session_name # Terminate the current session and return to the session named session_name screen -S session_name -X quit # Delete session_name session
ctrl+a x # Lock the current shell window, requires user password to unlock ctrl+a d # Detach: temporarily leaves the current session ctrl+a z # Puts the current session into the background ctrl+a [ # Scroll and view terminal output