Linux screen cheat sheet

Linux screen cheat sheet

Tags
Linux
Published
March 23, 2020
Author
yanbc

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 by d

Working in multiple windows

  • Create a new window: ctrl + a followed by c
  • Switch to another window: ctrl + a followed by "
  • Kill current window: ctrl + a followed by k

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 by S (upper case)
  • Split screen vertically: ctrl + a followed by |
  • Switch between different regions: ctrl + a followed by tab
  • Remove current region: ctrl + a followed by X (upper case)
  • Un-split all regions for the current layout: ctrl + a followed by Q (upper case)
  • Save current layout: ctrl + a followed by : then type the following command layout save mylayout