Overview
Linux
screen
is a command-line tool that lets you run multiple terminal sessions in a single window or remotely. It's useful for managing multiple sessions and can keep them running even if you lose your connection. It has features like detaching and reattaching to sessions, splitting your terminal into multiple regions, and sharing sessions with other users.Basic commands
- Start a new session:
screen -S <session name>
- List running sessions:
screen -ls
- Attach to a running session:
screen -r <session name>
- Detach from a session:
ctrl
+a
followed byd
Working in multiple windows
- Create a new window:
ctrl
+a
followed byc
- Switch to another window:
ctrl
+a
followed by"
- Kill current window:
ctrl
+a
followed byk
Split screen into multiple regions
One of the most powerful features of screen is the ability to split your terminal window into multiple regions, each running its own shell.
- Split screen horizontally:
ctrl
+a
followed byS
(upper case)
- Split screen vertically:
ctrl
+a
followed by|
- Switch between different regions:
ctrl
+a
followed bytab
- Remove current region:
ctrl
+a
followed byX
(upper case)
- Un-split all regions for the current layout:
ctrl
+a
followed byQ
(upper case)
- Save current layout:
ctrl
+a
followed by:
then type the following commandlayout save mylayout