Skip to content

Instantly share code, notes, and snippets.

@nikolaybotev
Last active September 29, 2021 17:54
Show Gist options
  • Save nikolaybotev/42cccbb73dcbe17ec76241fd4fbb09c6 to your computer and use it in GitHub Desktop.
Save nikolaybotev/42cccbb73dcbe17ec76241fd4fbb09c6 to your computer and use it in GitHub Desktop.
screen Cheatsheet

Screen Cheatsheet

Essentials

Technically all the commands in this section apply to screen sessions. For brevity, we refer to screen sessions as simply screens.

Open a New Screen

screen

Detach from Screen

Ctrl-A, d

List Screens

screen -ls

Rename a Screen

screen -S <screen-number> -X sessionname <screen-name>

Reattach to Screen

screen -r <number-or-name>

Open a Named Screen

screen -S myscreen

Start a Shared Screen

screen -d -m -S sharedscreen

Attach to a Shared Screen

screen -x sharedscreen

More Shortcuts

Clear Screen

Ctrl-A, Shift-C

Log Screen Output

Ctrl-A, Shift-H

Writes to screenlog.<window-number>.

Repeat again to stop logging.

Monitor Window for Activity

Ctrl-A, Shift-M

Monitor Window for Silence

Ctrl-A, _

Copy

Ctrl-A, [

Move around using vim commands (h, j, k, l, or arrow keys) to the start of your selection, press Return to begin selection, move to the end of the selection, and press Return agian to copy.

Paste

Ctrl-A, ]

Windows

Multiple windows can be opened per screen session.

Open a New Window

Ctrl-A, c

Rename Window

Ctrl-A, Shift-A

Switch to Last Window

Ctrl-A, Ctrl-A

Switch to Next Window

Ctrl-A, n

Switch to Previous Window

Ctrl-A, p

Switch to 1st Window

Ctrl-A, 0

Switch to 2nd Window

Ctrl-A, 1

... and so forth.

Switch to Window from List

Ctrl-A, "

Show All Windows

Ctrl-A, w

Regions

A display can be split horizontally and vertically into regions.

Split Display Horizontally

Ctrl-A, Shift-S

Move to Next Region

Ctrl-A, Tab

Split Display Vertically

Ctrl-A, |

Close Current Region

Ctrl-A, Shift-X

Close All Other Regions

Ctrl-A, Shift-Q
@nikolaybotev
Copy link
Author

To move a running process to screen (has caveats), see https://www.linkedin.com/pulse/move-running-process-screen-bruce-werdschinski/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment