YouTube Icon

Code Playground.

How To Use Linux Screen


How To Use Linux Screen

Have you ever confronted the circumstance where you play out a long-running assignment on a far off machine, and unexpectedly your association drops, the SSH meeting is ended, and your work is lost. Indeed, it has happened to us all eventually, hasn't it? Fortunately, there is a utility considered screen that permits us to continue the meetings. 


Screen or GNU Screen is a terminal multiplexer. At the end of the day, it implies that you can begin a screen meeting and afterward open quite a few windows (virtual terminals) inside that meeting. Cycles running in Screen will keep on running when their window isn't obvious regardless of whether you get detached. 

Install Linux GNU Screen

The screen bundle is pre-introduced on most Linux distros these days. You can check on the off chance that it is introduced on your framework by composing: 

screen --version
Screen version 4.06.02 (GNU) 23-Oct-17

In the event that you don't have screen introduced on your framework, you can without much of a stretch introduce it utilizing the bundle administrator of your distro. 

Install Linux Screen on Ubuntu and Debian

sudo apt update
sudo apt install screen

Install Linux Screen on CentOS and Fedora

sudo yum install screen

Starting Linux Screen

To begin a screen meeting, basically type screen in your reassure: 


This will open a screen meeting, make another window, and start a shell in that window. 

Since you have opened a screen meeting, you can get a rundown of orders by composing: 

Ctrl+a ? 

Starting Named Session

Named meetings are valuable when you run different screen meetings. To make a named meeting, run the screen order with the accompanying contentions: 

screen -S session_name

It's consistently a smart thought to pick an engaging meeting name. 

Working with Linux Screen Windows

At the point when you start another screen meeting, it makes a solitary window with a shell in it. 

You can have different windows inside a Screen meeting. 

To make another window with shell type Ctrl+a c, the most readily accessible number from the reach 0...9 will be relegated to it. 

The following are some most basic orders for overseeing Linux Screen Windows: 

  • Ctrl+a c Create another window (with shell) 
  • Ctrl+a " List all window 
  • Ctrl+a 0 Switch to window 0 (by number ) 
  • Ctrl+a A Rename the current window 
  • Ctrl+a S Split current district evenly into two locales 
  • Ctrl+a | Split current district vertically into two locales 
  • Ctrl+a tab Switch the information center to the following locale 
  • Ctrl+a Toggle between the current and past district 
  • Ctrl+a Q Close all districts however the current one 
  • Ctrl+a X Close the current district 

Detach from Linux Screen Session

You can withdraw from the screen meeting whenever by composing: 

Ctrl+a d 

The program running in the screen meeting will keep on pursuing you withdraw from the meeting. 

Reattach to a Linux Screen

To continue your screen meeting utilize the accompanying order: 

screen -r

On the off chance that you have different screen meetings running on your machine, you should annex the screen meeting ID after the r switch. 

To discover the meeting ID list the current running screen meetings with: 

screen -ls
There are screens on:
    10835.pts-0.linuxize-desktop   (Detached)
    10366.pts-0.linuxize-desktop   (Detached)
2 Sockets in /run/screens/S-linuxize.

On the off chance that you need to reestablish screen 10835.pts-0, at that point type the accompanying order: 

screen -r 10835

Customize Linux Screen

At the point when screen is begun, it peruses its design boundaries from/and so on/screenrc and ~/.screenrc if the document is available. We can change the default Screen settings as per our inclinations utilizing the .screenrc document. 

Here is an example ~/.screenrc design with altered status line and few extra alternatives: 


# Turn off the welcome message
startup_message off

# Disable visual bell
vbell off

# Set scrollback buffer to 10000
defscrollback 10000

# Customize the status line
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'

Basic Linux Screen Usage

The following are the most essential strides for beginning with screen: 

On the order brief, type screen. 

Run the ideal program. 

Utilize the key arrangement Ctrl-a + Ctrl-d to separate from the screen meeting. 

Reattach to the screen meeting by composing screen - r. 


In this instructional exercise, you figured out how to utilize Gnu Screen. Presently you can begin utilizing the Screen utility and make various screen windows from a solitary meeting, explore between windows, disengage and continue screen meetings and customize your screen terminal utilizing the .screenrc document. 

There's parcels more to find out about Gnu Screen at Screen User's Manual page. 

In the event that you have any inquiries or input, don't hesitate to leave a remark.