GNU Screen is an application that allows you to run multiple virtual terminals in session mode. After creating a session, you can disconnect from it, and then reconnect from any other host with SSH client installed. Processes started in Screen continue to run even after the user disconnects from the session or from the host at all. This is another reason (apart from increasing the convenience of working in the command line by using the option to switch between windows) why Screen is used. If the Internet connection is unreliable, or the user has no way to maintain a persistent connection, or there is a need to start a process at the office and stop it at home, then using Screen (or similar applications such as Tmux) is a way to solve these problems.

    Screen commands for Linux*

    Once installed, you can run the Screen program with the command screen. This will create a session whose name will include the process ID of the session itself (PID) and part of the hostname. In order to assign a name to the session, you must specify the key -S:

    screen -S myscreensession01  
    

    After logging into a session, it is controlled by entering keyboard shortcuts. The input combination for Screen is ctrl + a. This is followed by entering the character that is defined to perform a particular action. For example, in order to disconnect from session, you should specify the symbol d, i.e:

    ctrl + a d  
    

    The c symbol is used to create a new window:

    ctrl + a c  
    

    Go to the next window:

    ctrl + a n  
    

    Goes to the previous window:

    ctrl + a p  
    

    To select a specific window:

    ctrl + a ``  
    

    or

    ctrl + a 1 (where 1 is the window number)  
    

    To delete the current window:

    ctrl + a k  
    

    When you delete the last window, the session itself is also destroyed. To delete all windows and exit the Screen:

    ctrl + a ctrl \  
    

    To split the window in two (horizontally):

    ctrl + a S  
    

    The complete list of combinations can be viewed in the documentation using the command:

    man screen  
    

    In order to see a list of available sessions, it is necessary to use the command:

    screen -ls  
    

    To connect to a specific session (e.g. myscreensession01):

    screen -x myscreensession01