Using Screen

Screen is a terminal multiplexer, which allows you to access multiple separate terminal sessions inside a single terminal window or remote terminal session.  This can be really useful when you are performing different tasks at the same time, or when you have a process that will take a long time to complete.


To install Screen

sudo apt-get install screen


Using Screen


Virtual terminals in Screen can be manipulated by pressing the Ctrl+A key combination, and subsequently pressing a key to execute one of the commands given below:

  • c creates a new virtual console
  • n switches to the next available virtual console
  • p switches back to the previous virtual console
  •  lists all available virtual consoles and their assigned numbers
  • hitting a number key brings the corresponding virtual console to the foreground
  • Esc lets you scroll back and forth in your terminal output
  • d detatches the current screen sessions and brings you back to the normal terminal

When a Screen session is detached, the processes that were running inside it aren’t stopped. You can re-attach a detached session by typing the following

screen -r