How To Use Screen On Linux
2 min read

Working with Screen

Screen is a great tool to separate your windows in a Linux environment. It enables you to switch between different screens effortlessly.

Installing

First of all, you need to install Screen.

sudo apt-get screen

Basics

Start a new screen with the screen command. You will often use CTRL + A and then another key to do actions. For example, CTRL + A and ? will show you all commands.

To create a name to your Screen session, use the -S flag.

screen -S session_name

You can list all active screens with this command.

screen -ls

Detach

The easiest way to detach from a screen is CTRL + A and then D.

Reattach

Retaching can be done simplest with the -r flag.

screen -r

Will resume to the latest Screen session. You can specify name or ID after if you want to attach to a specific session.

screen -r <session>

Close

There are some ways you can close your session.

Inside the Screen

CTRL + A and then X

CTRL + A and then :quit

Outside of the Screen

screen -ls to get all sessions.

screen -XS <session> quit to quit the session.

  • -X - Execute command
  • -S - Choose session