GNU Screen keyboard shortcuts

Default key bindings and everyday commands of GNU Screen 5.0.2, taken from the Screen User’s Manual and checked against the release source. Every binding is a sequence: Ctrl + A, C means press Ctrl + A, release it, then press C. Letters are case-sensitive, so a capital is written with Shift. Copy mode keys, window list keys, shell options and colon-prompt commands have their own sections. Mouse actions and the keys of the displays list are left out.

171 shortcuts in 12 sections. Checked row by row against GNU Screen User’s Manual on . Edited by Jay.

Starting and attaching sessions 18

ActionShortcut
Start a new sessionOpens a single window running a shell; more windows are added from inside the session.screen
Start a named sessionThe name replaces the default tty.host suffix and is what screen -ls and screen -r show and accept.screen -S NAME
List sessionsEach session is marked attached, detached, multi, unreachable or dead; -list is the long spelling.screen -ls
Reattach a detached sessionWorks without a name only when exactly one detached session exists.screen -r
Reattach a session by nameNAME is the session name or the pid.name string printed by the session list.screen -r NAME
Detach elsewhere and reattachUse it when the session is still attached on another terminal.screen -d -r
Reattach or create a sessionLike -d -r, but starts a fresh session when none exists yet.screen -d -R
Attach here and nowDetaches the session elsewhere with a remote logout if needed, creates one if missing and takes the first when several exist.screen -D -RR
Resume first detached sessionFalls back to starting a new session when no detached one is found.screen -RR
Attach without detaching othersMulti-display mode: the same session is then shown on both terminals at once.screen -x
Start a session detachedCreates the session in the background without attaching, which suits startup scripts.screen -d -m
Send a command to a sessionAdd -S NAME to choose the session when several are running; it fails on password-protected sessions.screen -X COMMAND
Remove dead sessionsPrints the same list as screen -ls and deletes the entries of destroyed sessions.screen -wipe
Start with logging onEvery window writes its output to a screenlog file from the start.screen -L
Start with another command keyX replaces Ctrl + A and Y sends X literally; a control key is written with a caret, as in -e^Bb.screen -e XY
Use another configuration fileFILE is read in place of $HOME/.screenrc.screen -c FILE
Run in UTF-8 modeTells Screen the terminal speaks UTF-8 and makes utf8 the encoding of new windows.screen -U
Run a program in a new windowTyped at a shell inside a session, it opens a window there and does not start a second Screen.screen COMMAND

Sessions 8

The 5.0.2 manual prints the quit key as C-a \ and power detach as C-a D D. The 5.0.2 source binds quit to Ctrl + \ and power detach to a single capital D, and both ask for y or n before acting; the rows in this section follow the source.

Screen 4.9.1 differs in two places: power detach is confirmed by pressing the capital D a second time (the C-a D D of the manual), and Ctrl + A, T runs the time command, which Screen 5 no longer has.

ActionShortcut
DetachEvery window keeps running in the background until screen -r picks the session up again.Ctrl+AthenD
Power detachScreen 5 asks y/n, then detaches and hangs up the parent shell, which logs you out of a login shell.Ctrl+AthenShift+D
SuspendNeeds a parent shell with job control; the windows stay detached while it is stopped.Ctrl+AthenZ
Lock terminalRuns a lock program and accepts no command keys until it ends; programs in the windows keep going.Ctrl+AthenX
Quit ScreenAsks y/n, then ends the session together with all of its windows.Ctrl+AthenCtrl+\
Command lineTakes any command that could stand in .screenrc, so settings and bindings change on the fly.Ctrl+Athen:
Show key bindingsSpace pages through the list and Return closes it early.Ctrl+Athen?
Show attached displaysOne row per terminal connected to the session, which matters most in multiuser sessions.Ctrl+Athen*

Windows 15

Every binding here is a sequence: press Ctrl + A, release it, then press the next key. Commands on lowercase letters also answer to the same letter with Ctrl held, so Ctrl + A, Ctrl + C opens a window too. The table shows three exceptions: for A, H and V the Ctrl form runs a different command.

ActionShortcut
New windowThe window gets the lowest free number and runs your default shell.Ctrl+AthenC
Next windowPress it repeatedly to cycle through the whole window list.Ctrl+AthenNorCtrl+AthenSpace
Previous windowCtrl + A, Ctrl + H is a third way to step back.Ctrl+AthenPorCtrl+AthenBackspace
Toggle previous windowIt is the command character typed twice, and returns to the window shown before this one.Ctrl+AthenCtrl+A
Select window by numberWindows are numbered from 0 in the order they were created.Ctrl+Athen0-9
Select blank windowShows the internal empty window, the one a freshly split region starts with.Ctrl+Athen-
Select window by nameType a window title or a number at the prompt.Ctrl+Athen'
Window listOpens a table of every window; move with the arrow keys and press Enter on the one you want.Ctrl+Athen"
List windows on message lineAn asterisk flags the window you are in and a minus sign the one you came from.Ctrl+AthenW
Rename windowThe title you enter replaces the program name in the window lists.Ctrl+AthenShift+A
Kill windowAsks y/n first; killing the last window ends the session.Ctrl+AthenK
Show window numberPrints which number and title this window has.Ctrl+AthenShift+N
Parent windowRelevant with window groups, which arrange windows in a tree.Ctrl+AthenU
Toggle activity monitoringA message appears when the window produces output in the background, and the list marks it with @.Ctrl+AthenShift+M
Toggle silence monitoringNotifies you once the window has been quiet for 30 seconds, the default wait.Ctrl+Athen_

Window list keys 21

ActionShortcut
Up one lineCtrl + P is a third key for the same step.KorUp
Down one lineCtrl + N moves the same way.JorDown
First lineHome
Last lineCtrl + E is the alternative key.End
Half page upCtrl+U
Half page downCtrl+D
Full page upCtrl+B
Full page downCtrl+F
Go to numbered line0-9
Search the list/
Repeat list search forwardN
Repeat list search backwardShift+N
Toggle most-recently-used orderSwitches between sorting by window number and by most recent use.M
Toggle group nestingShows or hides the windows that sit inside window groups.G
All window viewA
Back out of groupCtrl + H steps out of the group as well.Backspace
Swap number with previous window,
Swap number with next window.
Kill highlighted windowShift+K
Select highlighted windowSpaceorEnter
Exit window listCtrl + G closes the list as well.Esc

Split regions 7

ActionShortcut
Split horizontallyStacks the two regions one above the other; the new one shows the blank window at first.Ctrl+AthenShift+S
Split verticallyPuts the two regions side by side; scrolling output is noticeably slower in such a split.Ctrl+Athen|
Next regionCycles through the regions and wraps from the bottom right back to the top left.Ctrl+AthenTab
Previous regionRuns focus prev; it depends on the terminal sending its back-tab key for Shift + Tab.Ctrl+AthenShift+Tab
Keep only this regionRemoves every split at once and leaves a single region.Ctrl+AthenShift+Q
Remove current regionDoes nothing when the display has just one region.Ctrl+AthenShift+X
Fit window to regionNeeded when a window is shown more than once, because its size is not adapted automatically.Ctrl+AthenShift+F

Copy and paste 6

ActionShortcut
Enter copy modeOpens the window and its scrollback in a vi-like editor for scrolling and marking text.Ctrl+Athen[orCtrl+AthenEsc
PasteTypes the text held in the paste buffer into the program of this window.Ctrl+Athen]
Paste previous command lineType the first letter of an earlier command, then this key; Screen searches the window and scrollback for it.Ctrl+Athen{orCtrl+Athen}
Write paste buffer to fileThe file is /tmp/screen-exchange unless bufferfile names another one.Ctrl+Athen>
Read file into paste bufferLoads the exchange file, a simple way to hand text to another user on the same host.Ctrl+Athen<
Delete exchange fileUnlinks /tmp/screen-exchange or the file set with bufferfile.Ctrl+Athen=

Copy mode movement 34

ActionShortcut
Cursor leftCtrl + H moves left as well.HorLeft
Cursor downCtrl + N is the third key for this.JorDown
Cursor upCtrl + P does the same job.KorUp
Cursor rightLorRight
Leftmost column0
Start of next line+
Start of previous line-
Top line of windowThe cursor lands in the leftmost column of that line.Shift+H
Middle line of windowShift+M
Bottom line of windowShift+L
Go to columnType the column number first, then this key.|
Start of bufferTakes you to the oldest line kept in the scrollback.GorHome
Go to lineWithout a number typed first it jumps to the last line of the buffer.Shift+GorEnd
Jump to percentage of bufferType a number first: 50 followed by this key lands halfway through the history.%
First non-blank character^
Last non-blank character$
Next wordWords follow the vi rules; the Shift variants of B and E use whitespace-separated WORDs.W
Previous wordB
End of wordE
Previous WORDA WORD is delimited by whitespace only, as in vi.Shift+B
End of WORDShift+E
Find character forwardType the target character next; a count such as 3 picks the third match.F
Find character backwardShift+F
Till character forwardStops one column short of the target, where F lands on it.T
Till character backwardShift+T
Repeat last find;
Repeat last find reversedRuns the previous F or T search the other way round.,
Scroll display up a lineOnly the view moves; the cursor stays where it was in the text.Ctrl+E
Scroll display down a lineCtrl+Y
Scroll up half a screenA number typed first sets how many lines to scroll.Ctrl+U
Scroll down half a screenCtrl+D
Cursor up one full screenCtrl+B
Cursor down one full screenCtrl+F
Repeat countType the number before a copy mode command to run it that many times.0-9

Display 6

The manual writes C-a for Ctrl + A, and letter case matters: C-a c opens a window while C-a C clears the screen. This page writes that capital as Shift + C. In .screenrc and after the -e option, control keys take the caret form, ^A.

ActionShortcut
Clear screenThe cleared text is saved to the scrollback buffer first.Ctrl+AthenShift+C
Redraw windowForces a full repaint, which partial redraw mode otherwise skips.Ctrl+AthenL
Reset terminalClears leftovers such as scroll regions or a graphics character set that a program left behind.Ctrl+AthenShift+Z
Toggle 80 or 132 columnsNeeds a terminal that can change width and the termcap entries Z0 and Z1.Ctrl+AthenShift+W
Toggle line wrapWhen on, output that reaches the last column continues at the start of the following line.Ctrl+AthenR
Toggle visual bellIf the terminal has no visual bell, a message in the status line stands in for it.Ctrl+AthenCtrl+G

Info and logging 7

ActionShortcut
Window infoThe message line lists cursor position, window size, scrollback size, flow control and wrap state.Ctrl+AthenI
Repeat last messageHandy when a message vanished because you pressed a key while it was showing.Ctrl+AthenM
Show versionPrints the version number and its date in the message line.Ctrl+AthenV
Show license pageThe same page appears whenever Screen is started without options.Ctrl+Athen,
Save screen to fileWrites the visible window to hardcopy.N, where N is the window number.Ctrl+AthenH
Toggle loggingAppends all further output of the window to screenlog.N; earlier scrollback is not included.Ctrl+AthenShift+H
Write termcap fileThe file .termcap goes to $HOME/.screen or wherever Screen keeps its sockets.Ctrl+Athen.

Terminal control 8

ActionShortcut
Send prefix to programPasses a real Ctrl + A to the program in the window, which Screen would otherwise intercept.Ctrl+AthenA
Send breakMostly useful when the window is attached to a serial device, not to a shell.Ctrl+AthenB
Reopen terminal lineReopens the line of the window and then sends a break condition.Ctrl+AthenShift+B
Cycle flow controlSteps the window through on, off and auto; the info line shows the current state.Ctrl+AthenF
Send XONRedundant while flow control is set to off or auto.Ctrl+AthenQ
Send XOFFSends Ctrl + S to the program; in copy mode the same keys start a forward incremental search.Ctrl+AthenS
Toggle login stateAdds or removes the /etc/utmp record of the window, which programs such as talk consult.Ctrl+AthenShift+L
Enter digraphType two characters next, for example a and a double quote for an a-umlaut.Ctrl+AthenCtrl+V

Commands for the colon prompt 20

ActionShortcut
Focus region aboveNo default key runs the directional forms; the manual suggests bind k focus up.focus up
Focus region belowfocus down
Focus region to the leftNothing happens when the current region is already the leftmost one.focus left
Focus region to the rightfocus right
Grow region by N linesWrite +20% for a relative percentage; the neighbouring regions give up the space.resize +N
Shrink region by N linesresize -N
Maximize regionAn underscore in place of max means the same.resize max
Minimize regionresize min
Make all regions equalThe -b option applies the change to both width and height.resize -b =
Set scrollback sizeApplies to the current window only; the default is just 100 lines.scrollback NUM
Set default scrollback sizeA line for .screenrc: every window created afterwards keeps NUM lines of history.defscrollback NUM
Change command characterX becomes the prefix and Y the key that sends it literally; control keys are written like ^B.escape XY
Bind a keyCtrl + A followed by KEY then runs the command; bind KEY alone removes a binding.bind KEY COMMAND
Run commands from a filePoint it at your .screenrc to apply edits to a running session.source FILE
Rename sessionShells that are already open keep the old name in $STY.sessionname NAME
Renumber windowIf another window already has that number, the two swap places.number N
Save scrollback to a fileWith -h the scrollback buffer is written too, not only the visible screen.hardcopy -h FILE
Create a layoutA layout is a named arrangement of regions; the display starts over with one region on the blank window.layout new TITLE
Save region arrangementThe saved splits come back when the session is reattached, but are lost when the session ends.layout save TITLE
Enable mouse clicksA left click then selects a region, and in copy mode it sets a mark.mousetrack on

Notes

Sessions

Run screen -S NAME to start a named session, work, and press Ctrl + A, D to detach; screen -r NAME reattaches, and screen -ls lists sessions when you have forgotten the name. If the session is still attached on another terminal, screen -d -r detaches it there first, and screen -x joins it without detaching anyone. Ctrl + A, Shift + D detaches and logs out of the terminal in one step. Ctrl + A, X locks the terminal, and Ctrl + A, Ctrl + \ quits Screen entirely, killing every window — it asks first. Ctrl + A, : opens a command line for any screen command, and Ctrl + A, ? shows the current bindings.

Windows and regions

Ctrl + A, C opens a new window, Ctrl + A, N and Ctrl + A, P move between them, Ctrl + A, Ctrl + A toggles to the previous one and Ctrl + A, 0-9 jumps by number. Ctrl + A, Shift + A names a window so Ctrl + A, " — the window list — is readable, and Ctrl + A, K kills one after a y/n question. Ctrl + A, Shift + S splits the display into regions one above the other and Ctrl + A, | side by side; Ctrl + A, Tab moves between them, Ctrl + A, Shift + X removes the current one and Ctrl + A, Shift + Q returns to a single region. A new region shows the blank window until you select a window into it with Ctrl + A, ".

Scrollback, copying and monitoring

Ctrl + A, [ enters copy mode, where the arrow keys and vi keys move through the scrollback, Ctrl + B and Ctrl + F page, and Space marks the start and then the end of a selection; Ctrl + A, ] pastes it. Any key without a copy-mode function, Esc for instance, leaves the mode without copying. Screen keeps only 100 lines of history per window by default; defscrollback in .screenrc raises that. Ctrl + A, Shift + H toggles logging the window to a file, which is how a long job’s output survives. Ctrl + A, Shift + M monitors a window for activity and Ctrl + A, _ for silence, each showing a message when triggered — useful for a build running in another window. Ctrl + A, L redraws a garbled screen.

Screen 4 and Screen 5

The rows describe Screen 5.0.2. On a system that still has the 4.9 series, two keys behave differently: power detach wants the capital D twice instead of a y/n answer, and Ctrl + A followed by T runs the time command, which Screen 5 removed. Ctrl + A, V prints the version you are on. The manual of 5.0 still prints the quit key as C-a \ and power detach as C-a D D; the source of the release binds Ctrl + A, Ctrl + \ and a single Ctrl + A, Shift + D.

Questions

How do I detach and later reattach?

Ctrl + A, D detaches. screen -r reattaches (screen -r NAME if there are several; screen -ls lists them). If the session is still attached on another terminal, use screen -d -r.

How do I scroll up?

Ctrl + A, [ enters copy mode; move with the arrow keys or K and J, page with Ctrl + B and Ctrl + F, then press Esc to leave. Only 100 lines per window are kept unless defscrollback sets a larger number in .screenrc.

Why is my new region blank?

Regions start with the blank window. Press Ctrl + A, " and pick a window, or Ctrl + A, C to create one in that region.

Why does Ctrl + A, D, D not log me out in Screen 5?

Screen 5 replaced the double D of Screen 4 with a question: press Ctrl + A, Shift + D once and answer y to "Really detach and send HANGUP to parent process [y/n]". The 5.0 manual still prints the old C-a D D.

How do I send a real Ctrl + A to the program inside Screen?

Press Ctrl + A, A. To move the command key somewhere else, start with screen -e XY or put escape XY in .screenrc, writing a control key with a caret, for example ^Bb for Ctrl + B.

Should I use screen or tmux?

tmux has more features and better defaults; screen is worth knowing because it is installed on many older systems where tmux is not.

Sources and checks

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

1 row from the earlier version of this page was removed in that check: duplicates, and bindings the documentation does not list or lists differently.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.