Screen Command in Linux

Reading Time: 4 minutes

Screen command in Linux , It is a terminal multiplexer. In Linux, the screen command provides the ability to launch and use the multiple shell session with the same single session. Basically, a screen is used when a process takes more time or when we need to run something for a long time. Suppose that we want to run a process for a long time and here is one thing that we need to care about, the session should not terminate otherwise the process will also terminate.

To avoid this problem or to solve this problem, Screen comes into the picture. With the help of a screen, We can create a shell session and run the process. When we start a process with a screen that process can be detached any time from the session but whenever we will check that process on the screen. we will find that process is running state and the process is managed by the screen itself.

In simple words, the Screen command can push the current running terminal to the background and pull them whenever you need or want to check.

Command use cases of screen command

  • The standard use of screen command is to create a new session with a shell in it.
  • Run a screen command, and then push the window to the background which is known as detaching. When you want to see your process, you can pull the session which is known as reattach and use it again.
  • When you have got a screen session running, you can create new sessions and run various processes in it.
  • You can also split your terminal sessions into various modes like vertical or horizontal regions,

Installation of screen:

To install screen on ubuntu, use this command:

sudo apt-get install screen

Getting Started with screen:

To start screen, We can simply type screen and hit Enter:


After running the screen command you will see a page that looks like the below page which has the information about the license. You can press space or enter to return to the command prompt.

How to use screen:

Here, We are going to download the source code for the latest Linux kernel into a file called

We are using the below command to download that source code:

curl >

Downloading starts, and the output shows in the progress as below:

 We can simply type Ctrl+A then release keys, and then press d to detach the screen.

That process is still running in the background but the window shows us that download is removed. You can simply reach with that screen and see the process is still running.

We can also list all running screens. Just run the command screen -ls.

screen -ls

Now you have seen the screens which are running in the background. Now if you want to reattach to that screen then we can simply type the command with the number of sessions to reattach or name.

screen -r <name of process or process id>

screen -r 243923

Here -r is used to reattach.

After running the reattach command you will see the process is still running.

If you want to terminate this process or end this process then you can simply type exit from the screen. Alternatively, you can press CTRL + A and then K to forcefully kill that window.


You’re returned to your previous terminal window, which will still show the command you used to reattach the window. Because we closed our one and only detached window, we get a message that the screen is terminating.

You are returned to your last terminal where you have run the screen -r 5\686\6 command because you have closed that session and detached the window. You can see a message that the screen is terminating.


First of all, Thank you for reading my blog. Please leave your valuable feedback. We have covered the basics of screen command in this blog. You can follow this link to know more about the screen command.

Written by 

Mohd Muzakkir Saifi is a Software Consultant at Knoldus Software. He loves to take deep dives into cloud technologies & different tools. His hobbies are playing gymnastics and traveling.