+5 votes
214 views
How to use Screen Linux command

in Linux / Unix by (551k points)
reopened | 214 views

1 Answer

+3 votes
Best answer

How to use Screen Linux command

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
 sudo apt install screen 
If we use Red Hat, Fedora or CentOS
 sudo yum install screen 
image
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 
image
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)

+ ac Ctrl + ac

List all windows

+ a " Ctrl + a "

Switch to window 0 (by number)

+ a + 0 Ctrl + a + 0

Modify the name of the current window

+ a + c Ctrl + a + c

Divide the current region horizontally into two regions

+ aS Ctrl + aS

Divide the current region vertically into two regions

+ a | Ctrl + a |

Create a tab

Ctrl +

Switch between current and previous region

+ a Ctrl + a Ctrl + a Ctrl + a

Close all regions except the current one

+ a Q Ctrl + a Q

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 

image

Step 7

We can resume a session by its ID:
 screen -r ID 

image

Pressing Enter will access that session in the background, so Screen works on Linux for proper and safe work of each session..


by (3.5m points)
edited

Related questions

+3 votes
1 answer
asked Oct 20, 2020 in Linux / Unix by backtothefuture (551k points) | 218 views
+4 votes
1 answer
asked Sep 22, 2020 in Linux / Unix by backtothefuture (551k points) | 309 views
+3 votes
1 answer
+4 votes
1 answer
asked Jul 29, 2020 in Linux / Unix by backtothefuture (551k points) | 451 views
+4 votes
1 answer
asked Jun 12, 2020 in Linux / Unix by backtothefuture (551k points) | 303 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,632 questions
10,764 answers
510 comments
3 users