Skip to content
Menu
Janaki Joshi
  • My Gallery
  • About Me
Janaki Joshi
May 7, 2019

Using Screen in Linux

Screen is a small program in Linux which is useful while running long running tasks, screen keeps a shell active even though network disruptions. In other words, it means that you can start a screen session and then open any number of windows (virtual terminals) inside that session. Processes running in Screen will continue to run when their window is not visible even if you get disconnected. One of the use cases for running screen would be to run scripts, which takes a lot of time to process such that network connection may time out.

The screen package is pre-installed on most Linux distros nowadays. You can check if it is installed on your system by typing:

 

 

Command used to activate screen:

 

 

 

Fig: Command to go into screen

 

This will open a screen session blank screen appears.

 

 

 

Once screen is activated, use it as a normal shell console. For example, execute some Procedure ( exec sp_processinfo(1,’D’) )

 

 

Fig: example of running a script while using screen

 

The user can then close the console and the script will run to completion.

To check on the progress of screen, it can be re-attached to console. The user can user ‘screen –ls’ to see which screen is active and choose which screen to re-attach to check its progress. Reattachment of screen to current console can be done using ‘screen –r <screen number>’

 

 

 

 

Fig: Command to display list of active screens

 

 

 

 

Fig: Using screen –r to reattach screen on ‘50444’

User can exit out of screen to regular console by using exit command.

 

 

Fig: Quit from screen console

 

Below are some most common commands for managing Linux Screen Windows:

Ctrl+a c Create a new 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 region horizontally into two regions

Ctrl+a | Split current region vertically into two regions

Ctrl+a tab Switch the input focus to the next region

Ctrl+a Ctrl+a Toggle between the current and previous region

Ctrl+a d The program running in the screen session will continue to run after you detach from the session.

Ctrl+a Q Close all regions but the current one

Ctrl+a X Close the current region

 

Connect and Share

Recent Posts By Janaki

  • 7 Japanese Techniques for Staying Energized and Focused
  • AI’s Agile Journey
  • Lost and Found: A Journey to Discovering Yourself
  • Kanban: Mastering the Art of Flow
  • Finding Your Way Back

Archives

  • May 2025
  • August 2023
  • April 2023
  • October 2022
  • February 2022
  • December 2021
  • January 2021
  • May 2020
  • March 2020
  • December 2019
  • November 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • March 2018

Categories

  • Agile Methodology (8)
  • Empowerment (3)
  • Enjoy (2)
  • Knowledge (19)
  • Lean (1)
  • Lifestyle (24)

Calender

May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Aug    

Recent Comments

  • Prakriti khadka on What is this life really worth
  • Pratikshya Joshi on What is this life really worth
  • Sujata GHIMIRE on What is this life really worth
  • Pratikshya Joshi on Being Mother
  • janakijoshi on Retrospective of 2019
©2025 Janaki Joshi | Powered by WordPress and Superb Themes!