Skip to content

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Tools - Screen

Description

screen is a "terminal multiplexer" allowing to open several terminals in the same console, to switch from one to the other and to recover them later.

It offers other very useful services such as:

  • The ability to attach and detach a session
  • The possibility of sharing a terminal with another user, ideal for helping a remote user.

Installation

If screen is not already installed on your distribution, launch the installation simply as follows:

yum (or dnf) update
yum (or dnf) install screen

apt-get update
apt-get install screen

Use it

Some commands

Create a new session

screen -S <session_name>

Close a session:

exit

List current session:

screen -ls

Attach to an existing session:

screen -r

Force detachment from a session:

screen -d <Id|Name Session>

Shortcuts

There are many keyboard shortcuts for interacting with sessions.

Kill screen

Combination Description
Ctrl + D Equivalent to exit. When there is only one console left screen
Ctrl + A Also quits and closes. When there is only one console left screen

Detach screen

Combination Description
Ctrl + a then d Detach screen
Ctrl + a then DD Detach screen and close session

Split console

Combination Description
Ctrl + a then | Separates the current console into two consoles vertically (the current console becomes the one on the left).
Ctrl + a then S Separates the current console into two consoles horizontally (the current console becomes the one above).
Ctrl + a then Tab Once the console is separated, this shortcut allows you to position yourself on the next console.
Ctrl + a then​​​​​​​ Q Delete all consoles except the current console.
Ctrl + a then​​​​​​​ K Kills the current console and the processes found there.
Ctrl + a then​​​​​​​ X Closes the current session.

Various

Combination Description
Ctrl + a then​​​​​​​ F Resize the window to the size of its terminal. Useful when you are several on the same console and you get angry at not having a 16:9 screen.
Ctrl + a then​​​​​​​ H Log everything that goes on the screen in a file $HOME/screenlog.XX (XX: console number)
Ctrl + a then​​​​​​​ ? Display a little help

Move and Copy

Combination Description
Ctrl + a then​​​​​​​ Esc Enter copy /scrollback mode. You can move around the screen with the directional arrows.
Enter Starts a selection. Press Enter again to complete the selection.
Ctrl + a then​​​​​​​ ] Pastes the previously selected content.
Back to top