Today we talk about screen: a small utility command line for Linux systems.

Screen, quite simply, he's able to multiply the terminals at our disposal, of undock a terminal by its process and maintain active process in the background (by returning the terminal to use).

Screen is particularly useful when it launches a command that requires a response time rather long (such as a backup) be it launched locally or on a remote server. The timeout of the server or the user accidentally kill could lead to an interruption command and frustrate the time spent.

But let's see how it works:

screenstart screen and returns the shell
screen + comandostart the program “command” inside “screen”
Once started “screen
ctrl+a” and then “ccreates a new terminal
ctrl+a” and then “nskips to the next terminal
ctrl+a” and then “pswitches to the previous terminal
ctrl+a” and then “d“unhooks” screen from the session

Once unhooked from the session can end the SSH tunneling or close the terminal. The program will continue to run in the background.

To retrieve a previous session will take “hang up”:

screen -listlists all the started sessions
screen -rretrieves a previously started session

Below is one example of the terminal with two sessions “dropped” The screen.

joe@joe-desktop:~$ screen -d
There are screens on:
16268.pts-3.joe-desktop (01/12/2019 20:58:09) (Detached)
23799.pts-4.joe-desktop (01/12/2019 16:30:08) (Detached)
There is no screen to be detached.
joe@joe-desktop:~$

To “hang up” to a specific session just specify the PID. I our case “screen -r 16268“.

To clear a screen that is the command: screen -X -S {PID della sessione} kill.

Not enough?


TheJoe

I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.

0 Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.