tmux cheatsheet


Session groups one or more windows together.

Each session has one current window, this is the window displayed when the session is attached and is the default window for any commands that target the session. Sessions do not have an index but they do have a name, which must be unique.

Every window has a name – by default tmux will choose one but it can be changed by the user. Multiple windows are grouped together into sessions. If a window is part of a session, it is said to be linked to that session.

Windows may be linked to multiple sessions at the same time, although mostly they are only in one. Each window in a session has a number, called the window index – the same window may be linked at different indexes in different sessions.

  • List existing sessions
    tmux ls
  • Create a new session with name and without name
    tmux new -s name
    tmux new
  • Attache to an existing session or most recently used sessions
    tmux attach -t name
    tmux attach
  • Rename session (within a session)
    Ctrl-b $
  • Detach the currently attached session
    Ctrl-b d
    tmux detach
  • Switch session (within a session)
    Ctrl-b s
    tmux switch -t name
  • Kill a session by name:
    tmux kill-session -t name

The status line

When a tmux client is attached, it shows a status line on the bottom line of the screen. 

As new windows are opened, the window list grows – if there are too many windows to fit on the width of the terminal, a < or > will be added at the left or right or both to show there are hidden windows.

In the window list, the current window is marked with a * after the name, and the last window with a -.


A window groups one or more panes together, linked to one or more sessions.

  • Create a new window
    tmux new-window
    Ctrl-b c
  • Change to a window using index
    tmux select-window -t :0-9
    C-b 0 changes to window 0
    C-b 1 to window 1, up to
    C-b 9 for window 9.
  • Change to next window in the window list by number. 
    C-b n 
  • Change to previous window int he window list by number
    C-b p
  • Rename the current window
    tmux rename-window
    Ctrl-b ,
  • Choose a window from the list
    Ctrl-b w


A pane contains a terminal and running program, appears in one window

Splitting the window

A pane is created by splitting a window.

This is done with the split-window command which is bound to two keys by default:

  • tmux split-window
     C-b % splits the current pane into two horizontally, producing two panes next to each other, one on the left and one on the right.
  • tmux split-window -h
     C-b " splits the current pane into two vertically, producing two panes one above the other.

Each time a pane is split into two, each of those panes may be split again using the same key bindings, until the pane becomes too small.

Changing the active pane

The active pane can be changed between the panes in a window with these key bindings:

  • Change to the pane above, below, left or right of the active pane
    tmux select-pane -[UDLR]
    Ctrl-b Up, Ctrl-b Down, Ctrl-b Left and Ctrl-b Right .
    These keys wrap around the window, so pressing Ctrl-b Down on a pane at the bottom will change to a pane at the top.
  • Move to the next pane by pane number
    Ctrl-b o
  • Selects the next pane in numerical order
    tmux select-pane -t :.+

  • Print the pane numbers and their sizes on top of the panes for a short time
    Ctrl-b q
    Ctrl-b q 0 will change to pane number 0
    Ctrl-b q 1 will change to pane number 1
  • Swaps pane with another in the specified direction
    tmux swap-pane -[UDLR]
    Ctrl-b {
    Ctrl-b }
  • Swaps that pane with the active pane, so they exchange positions and sizes in the window.
    Ctrl-b Ctrl-o 

Pane numbers are not fixed, instead panes are numbered by their position in the window, so if the pane with number 0 is swapped with the pane with number 1, the numbers are swapped as well as the panes themselves.

Helpful tmux commands

  • Every default tmux key binding has a short description to help remember what the key does.
    tmux list-keys -N | less
    Ctrl-b ?
  • List out every bound key and the tmux command it runs
    tmux list-commands
  • List out every session, window, pane, its pid, etc.
    tmux info
  • Reload the current tmux configuration (based on a default tmux config)
    tmux source-file ~/.tmux.conf


Leave a Comment

Your email address will not be published. Required fields are marked *