GNU Screen cheat-sheet

posted by Arkham on January 26th, 2008

Screen Home:
http://www.gnu.org/software/screen/

Basics:

  • Ctrl+a c -> create new window
  • Ctrl+a A -> set window name
  • Ctrl+a w -> show all window
  • Ctrl+a 1|2|3|… -> switch to window n
  • Ctrl+a “ -> choose window
  • Ctrl+a Ctrl+a -> switch between last two windows
  • Ctrl+a n -> switch to next window
  • Ctrl+a p -> switch to previous window
  • Ctrl+a d -> detach window
  • Ctrl+a ? -> help
  • Ctrl+a [ -> start copy, move cursor to the copy location, press ENTER, select the chars, press ENTER to copy the selected characters to the buffer
  • Ctrl+a ] -> paste from buffer
  • Ctrl+a : screen foo -> create a new window executing foo and set its name

How to use screen:

  • screen -ls -> list of detached screen
  • screen -r PID -> attach detached screen session
  • screen -S MySession -> start a screen session with name MySession
  • screen -r MySession -> attach screen session with name MySession
  • screen -S MySession -md /usr/bin/foo -> start a screen session called MySession, launching /usr/bin/foo inside of it, and then detach it
  • screen -DR -> if a session is running, reattach; if necessary detach and logout remotely first. If it was not running, create it

Advanced:

  • Ctrl+a S -> create split screen
  • Ctrl+a TAB -> switch between split screens
    If you created a new split screen, the current window is empty. either select an existing window (ctrl a “) or create a new split screen (ctrl a n).
  • Ctrl+a Q -> Kill all regions but the current one.
  • Ctrl+a X -> remove active window from split screen
  • Ctrl+a O -> logout active window (disable output)
  • Ctrl+a I -> login active window (enable output)

Tags: , ,