Linux Screen Quick Start Guide

LinuxScreen is a great tool for running multiple shell instances using a single SSH connection or virtual console. Here’s a quick start guide to screen.

Essential Commands

Screen is usually installed by default on most servers. To run screen you just type:


It’ll likely display a splash screen so press enter to get rid of that. You’ll then be shown a normal shell prompt. To do multiple shell instances with screen you need to learn some essential commands.

Screen commands begin with Ctrl + a. Using Ctrl + a and then another key is the basic formula for a screen command. Some essential commands:

Ctrl + a and c – Create new “window”. A window being a new shell instance.

Ctrl + a and Ctrl + a – Switch to last window. Allows you to toggle between the most recent two windows.

Ctrl + a and w – See all screen windows

Ctrl + a and [0-9] – Switch to a specific window. For example to switch to the 0th window you type Ctrl + a and 0.

To exit a window just type exit as you normally would. You can also kill a window with Ctrl + a and k.


Detach and Reattach Screen sessions

One of the best features of screen is that you can detach from your screen session and it will continue to run in the background. You can then reattach and check up on the output of your scripts/programs at a later time. This is especially useful when you are updating software on a remote server. If you use screen to run `yum update` or `apt-get upgrade` the update will continue even if you get disconnected.

To detach from a session type Ctrl + a and d. To reattach at a later time run screen with the -r switch:

screen -r

For more information about screen checkout the man page by typing `man screen`

Leave a Reply

Your email address will not be published. Required fields are marked *