SIGN IN

    The utility screen can be useful on a server running the Linux operating system. From the manual page: Screen is a full-screen window manager that multiplexes a physical terminal between several processes (usually interactive shells). This utility can be used, for example, when it is necessary to manually start a process and then disconnect from the server. Or, it may be needed to preserve a session if there is a chance of session loss, or the possibility of some extraordinary disconnection from the server, such as during an internet connection failure.

    To work with the screen utility, you will need to connect to the server via ssh. 

    To install the screen utility, execute in Debian-like distributions:

    apt-get install screen


    In RPM-like distributions:

    yum install screen


    To launch the utility, enter in the command line:

    screen


    You can also start a session with a name, for example:

    screen -S archieving


    After entering these commands, a screen session is created, which externally resembles a regular terminal. You can work in it like in a normal terminal, enter commands, and run long-running processes that may potentially be interrupted.

    A screen session can be detached and then disconnected from the server, allowing you to continue performing other tasks or start another screen. To detach from the screen, press the keyboard combination Ctrl+a, d (first press Ctrl+a together, then d). You will return to the previous mode of your SSH session, from which you can disconnect.

    Multiple screen sessions can be opened. If you don't specify a name when creating a session, it will be assigned a numerical identifier and a default name. To view the list of screen sessions, execute the command:

    screen -ls



    In the output, you can see a list of sessions: their identification number and name. If the name was not assigned, it will be added automatically (for example, pts-0.myserver).

    To reattach to an existing session (if there was only one), execute the command:

    screen -r


    If there are multiple sessions, a list of existing sessions will be displayed. To attach to a specific session, you need to specify its name. For example,

    screen -r archieving


    or

    screen -r 30887


    To exit the screen session and close it, enter exit or press the Ctrl+d combination.

    Not all features of this utility have been covered. There are many other command-line options and commands that can be used within a screen session (such as creating windows, switching between them, and many others). To learn about all the capabilities of the program, refer to its manual:

     

    man screen


    To get help on the key combinations that can be used within a screen, press Ctrl+a, then the "?" symbol.

     

     

    Conclusion

    Basic features of the screen utility, such as creating sessions that can be detached or used to run long processes without fear of disconnections from the server, have been covered.