Screen – A tool to multiplex remote terminal session

Are you tired of opening multiple connections (multiplex sessions) to your remote server or embedded target machine ?

SSH connection

Then GNU screen is an apt tool for your day to day Linux life. Using a single connection (telnet/ssh) , you can manage multiple windows multiplexed within. It works like this.

Diagram2

 

Say you have a server named “code” . In order to open multiple windows using a single connection, you need to do the following.

Code:

ssh me@code 
(enter the password and you get a shell)
me@code:~$
apt-get install screen
or 
yum install screen
$ screen
#or to start a screen session with a name
$ screen -S your_session_name
Type "Control + a" and then "c" 

Lets create a couple of sessions by repeating the above steps.

moving forward over session, n means next
Type "Control + a" and then "n"
moving backward over session, p means previous
Type "Control + a" and then "p"

You can detach the screen and exit the connection.

Type "Control + a" and "d"

Later you can reattach like this.

screen -r 
or if you gave a session name
screen -r your_session_name

If you are moving away from the table then you can lock your screen like this.
You system password is used for locking it.

Type "Control + a" and then "k"

One thought on “Screen – A tool to multiplex remote terminal session

  • March 21, 2017 at 10:28 pm
    Permalink

    GNU screen has largely been supplanted by tmux, terminal multiplexer.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *