Skip to content

Instantly share code, notes, and snippets.

@azye
Last active May 18, 2021 06:11
Show Gist options
  • Save azye/078ffea2a17315fa7608d4de9260ec0a to your computer and use it in GitHub Desktop.
Save azye/078ffea2a17315fa7608d4de9260ec0a to your computer and use it in GitHub Desktop.
Learning GNU screen

Learning GNU screen

GNU screen is a terminal multiplexer. meaning it can create multiple virtual sessions from within a single terminal session. Using a terminal multiplexer also allows you to persist sessions after a terminal window is closed, create multiple windows for building more efficient workflows, and collaborate with other people working on the same servers as you.

All shortcuts are case-sensitive. i.e. ctrl+a S != ctrl+a s (ctrl+a S == ctrl+a <shift> s).

For all shortcuts, release ctrl+a before hitting next key.

Start a new screen session

screen

or

screen -S "name_of_session"

Detach a screen session

From within a screen session: ctrl+a d

List screen sessions

screen -ls

Reattach to a screen session

screen -r

or

screen -r "name_of_session"

Create a new window

ctrl+a c

Show all windows

ctrl+a "

You can select a window from this menu using arrow keys or 'j' and 'k', then return.

Moving through windows

ctrl+a n

where n is a window number

Splitting session into horizontal "regions"

ctrl+a S
note: capital S

another note: newly initialized regions will be empty. you can use the next step to move into the new region. From there, you can use previous steps to either create a new window (ctl+a c) or select an existing window (ctl+a n or ctl+a ")

Splitting session into vertical regions

note: vertical splitting is only available on screen versions >4.01, macOS is still on 4.0.0. you can update to a more recent version with brew install screen.

ctrl+a |
note: pipe

Moving between regions

ctrl+a tab

Closing a region

From region to close: ctrl+a X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment