Something that is really annoying and very angry is to be working in a Linux session and that from one moment to another it closes unexpectedly either due to an issue of electrical problem, errors in the equipment, software, etc ,. The problem is that we get angry because everything we have done will simply be lost, but fortunately we have a free solution called Screen which we will discuss in detail in this tutorial. Thanks to the use of Linux commands , we can always have an alternative to each task and that in loss of data is where you see how really useful they are..
What is Screen?
Screen or GNU Screen is a terminal multiplexer with which we can start a screen session and then open other windows called virtual terminals in that same session without anything being affected. This allows all processes executed on the screen to continue their execution work even if we disconnect the active session.
We will see in detail how to use Screen on Linux.
How to use Screen Linux command
Step 1
By default, Screen is installed in most distributions, but if this is not the case, we can simply install it by running the following. Enter the letter "S" to confirm the download and installation.
If we use Ubuntu or Debian
If we use Red Hat, Fedora or CentOS
Step 2
To start Screen we simply execute the following. This is responsible for opening a screen session, creating a new window and activating a shell in that new window.
screen
Step 3
To access the available commands we will execute the following:
Ctrl + a?
Step 4
If we are going to create a new window with the shell type Ctrl + ac, this will be assigned the first available number in a range from 0 to 9, some of the available commands are:
Create a new window (with shell)
Switch to window 0 (by number)
Modify the name of the current window
Divide the current region horizontally into two regions
Divide the current region vertically into two regions
Switch between current and previous region
+ a Ctrl + a Ctrl + a Ctrl + a
Close all regions except the current one
Step 5
To disconnect from the current Screen session we will execute Ctrl + ad and one way to better control is to identify the sessions:
screen -S session1
Step 6
To see all active sessions, or their status, we run:
screen -ls
Step 7
We can resume a session by its ID:
screen -r ID
Pressing Enter will access that session in the background, so Screen works on Linux for proper and safe work of each session..