Screen and Tmux Commands

Overview

The Linux tmux and GNU screen commands are terminal multiplexers – in brief, these commands let a user launch and use multiple shell sessions from a single ssh session.
The screen or tmux commands also allow a user to start a process in a terminal, disconnect from that terminal, and then reconnect without having to restart the process. This is very useful as your tmux/screen session will remain active even if you lose your network connection.

Both of these programs are available on Teton. At the command prompt, simply type screen or tmux and hit enter.

Shortcuts:

While in a terminal window, press Ctrl-a (for screen) or Ctrl-b (for tmux) to access these shortcuts. The screen variants are presented here.

  • Ctrl-a + c: creates a new screen

  • Ctrl-a + N: (where N is equal to the number of the screen) this key command switch us to a specific screen

  • Ctrl-a + a: switches us to the next screen

  • Ctrl-a + w: view a list of screens. The unique ID of each screen, along with its name, and running process is displayed, for each individual window. The current window will be marked with an asterisk (*).

  • Ctrl-a + “: allows us to view the screen picker

  • Ctrl-a + ? - shows the shortcut key options

  • Ctrl-a + p and Ctrl-a + n: used to switch to the next or previous window.

  • Ctrl-a + k: will kill the current window session.

  • Ctrl-a + d: to detach the current screen session.

  • Ctrl-a + r: to reattach a detached screen session.