• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Notes to Self

  • Aviation Weather from NOAA Plugin
    • KZZV
    • Bad Shortcode
    • Simple Metar
  • Meetings

Mark Chouinard / April 28, 2013

GNU Screen Cheat Sheet

GNU screen usage

This is a summary of some common command-line options and
keystrokes for use in the terminal multiplexer GNU screen.
For more details, see screen’s man page. All commands
(except in copy/scrollback mode or command-line mode)
start with the command character, which is assumed here to
be the default Ctrl+A (denoted here as “^a”).

Command-line options

screen Open up a new window with a command shell in it.

screen -D -R
Reattach a detached screen session.

screen -t Fooing foo bar baz
Create a new window, run the command “foo” with
arguments “bar” and “baz” in it, and title it
“Fooing”.

Basic command-character commands

^a ? Help.

^a a Send the command character itself (“^a”) to the
program running in the current window.

^a “ Present a list of all windows for selection.
Use the arrow or number keys (or vi- or
Emacs-style cursor keys) to highlight a window
and press <Enter> to switch to it.

^a 0 Switch to window number 0 (works with 0-9).

^a ^a Toggle to the window displayed previously. (If
you’re using another command character,
substitute it for both these “^a”s.)

^a A Change the current window’s title.

^a c Create a new window with a shell and switch to
that window.

^a <Esc> Enter copy/scrollback mode. (See
“Copy/scrollback mode” section below.)

^a ] Send the contents of the paste buffer to the
program running in the current window. (See
“Copy/scrollback mode” section below.)

^a t Show time, date, hostname, and some other stuff.

^a @ Do nothing. (Useful when you hit “^a” by
mistake.)

^a : Enter command line mode. (For example,
“^a :number 7” changes the window number of the
current window to 7. See the man page for more
details.)

^a ^z Suspend screen. (You will be back at the shell
you started screen from.)

^a d Detach screen. (Do this before you log out —
you will be back at the shell you started screen
from.)

Copy/scrollback mode

h,j,k,l Move cursor left, down, up, right (as in vi).
Regular arrow keys also work.

^b Page up (<PageUp> key also works).

^f Page down (<PageDown> key also works).

<Space> Set mark. When the second mark is set, the text
between the two marks will be put into screen’s
paste buffer and copy/scrollback mode will be
exited.

^ Move to first nonwhitespace character on current
line.

$ Move to last nonwhitespace character on current
line.

0 Move to leftmost column.

c Set the left margin for block-mode copying.

C Set the right margin for block-mode copying.

x Exchange the first mark with the current cursor
position. This is good for moving an already
set mark.

<Esc> Exit copy/scrollback mode. (Any key that
doesn’t have another meaning will do this.)

Regions

Regions let you view two or more screen windows at the
same time.

^a S Split the current region into two new ones.
(The blank window will be displayed in the new
region until you use one of the window selection
commands.)

^a <Tab> Switch focus to the next region.

^a Q Delete all regions but the current one. (This
does not destroy any windows.)

Filed Under: Ubuntu Tagged With: GNU Screen

Primary Sidebar

Post Archives

  • June 2024
  • December 2022
  • July 2022
  • December 2021
  • October 2021
  • June 2021
  • February 2021
  • October 2020
  • September 2020
  • August 2020
  • March 2020
  • February 2020
  • December 2019
  • September 2019
  • June 2017
  • May 2016
  • April 2016
  • March 2016
  • September 2015
  • August 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • June 2013
  • May 2013
  • April 2013
  • February 2013
  • January 2013
  • December 2012
  • January 2011

Footer

Copyright © 2025 · machouinard · Log in