How to install and use Screen

GNU Screen is a console utility-multiplexer that provides the user with access to several sessions in a single session.

Check if Screen is installed:

which screen

If installed, an installation path will appear, for example /usr/bin/screen.
If not installed, install:

sudo apt-get install screen

Screen launch:

screen

After that, you can already execute commands in the window or immediately launch an application:

screen COMMAND

Creates a session with the specified name (disable with Ctrl + a d):

screen -S NAME

Connection to the specified session:

screen -r NAME

Forced end of session:

screen -S NAME -X quit

List of running sessions:

screen -ls

Connect to screen session:

screen –x

If not one session is running, specify the necessary:

screen –x NAME

I will describe the possible key combinations:
Ctrl + a c – Create a new window
Ctrl + a w – Displays a list of numbers and titles of all windows in the bottom line of the screen
Ctrl + a ” – Lists all windows
Ctrl + a Window number – Select window by number. For example, the command Ctrl + a and 0 makes the current window with the number 0
Ctlr + a n – Switch to the next window in order, or to the first window if we were in the last window
Ctrl + a p – Switch to the previous window in order, or to the last window if we were in the first window
Ctrl + a ‘ – Display the prompt for entering the window number to switch
Ctrl + a Ctrl + a – Switch to the last used window
Ctrl + a N – Show the number and title of the current window
Ctrl + a A – Set the title of the current window
Ctrl + a k – Forced closing of a window, for example, in case an application cannot be closed in the usual way
Ctrl + a d (detach) – Disconnect a console session
Ctrl + a z (suspend) – Disconnect the console session and leave it running as a background process of the parent shell. In this case, in addition to the commands described below, standard commands for managing background shell processes can be used to restore the session.
Ctrl + a ? – Help about all shortcuts
Ctrl + a S – Split the screen into two regions horizontally.
Ctrl + a | – Split the screen into two regions vertically
Ctrl + a Tab – Jump between regions

Leave a comment

Leave a Reply