tmux Cheatsheet

Drew Leske

tmux is an essential utility for anybody who does a lot of work in terminal windows on Unix systems. It allows you to create multiple virtual terminals, switch between them, detach from them and reattach later and/or from elsewhere, and persists even if your connection to the host system fails or you need to drop it for some reason.

The following is a basic overview and reference for common use of tmux.

Typography:

  • Monospace indicates a command you type: tmux new
  • C-b c is a keystroke combination where you hold down the control key and press the B key, then press C

Starting tmux

tmux new [-s title]
create a new tmux session, optionally with the given title
tmux attach [-t title]
attach to an existing session, optionally that specified

In-session tmux commands

Essential

C-b C-a
switch to previous screen
C-b c
create a new virtual screen
C-b n
switch to the next screen
C-b p
switch to the previous screen
C-b <#>
switch to the given screen
C-b d
detach current session

More advanced: scrollback buffer

This one takes a bit more explanation as it is a “mode”, so this is a sequence to enter the mode, examine the buffer, and leave the scrollback mode.

C-b [
enter scrollback mode. In the top right corner an indicator for the current position within and length of the buffer is displayed.
Up, down, page up, page down
navigate the scrollback buffer.
C-c
Exit scrollback mode