Skip to main content

tmux Cheat Sheet

Summary

Cheat sheet for the open-source terminal multiplexer tmux. Getting started with tmux. Learn to master tmux with simple commands and shortcuts. For advanced usage, see the official documentation.

Leader #

The leader (also called prefix) — <C-b> — stands for the key combination Ctrl+b.

Session management #

Start a new session:

tmux

Start a new session with a name:

tmux new-session -s session_name

Attach to an existing session:

tmux attach-session -t session_name

List existing sessions:

tmux list-sessions

Detach from the current session (<C-b>+d):

tmux detach

Switch between sessions:

tmux switch-client -t session_name
CommandExplanation
<C-b>+slist sessions
<C-b>+$name sessions

Window management #

Create a new window (<C-b>+c):

tmux new-window

Switch between windows (<C-b>+1, <C-b>+2, etc.):

tmux select-window -t :1

Rename the current window (<C-b>+,):

tmux rename-window new_name

Close the current window (<C-b>+&):

tmux kill-window
CommandExplanation
<C-b>+ccreate new window
<C-b>+ngo to next window
<C-b>+pgo to previous window
<C-b>+[i]go to [i] window
<C-b>+'select the window index
<C-b>+winteractive index to choose window (0-9a-z)
<C-b>+ffind window by name
<C-b>+lgo to last used window
<C-b>+.interactively move window
<C-b>+,rename current window
<C-b>+&close current window

Pane management #

Split the current pane into two, left and right. (<C-b>+%):

tmux split-window

Split the current pane into two, top and bottom (<C-b>+"):

tmux split-window -h
CommandExplanation
<C-b>+%split current pane into two, left and right
<C-b>+"split current pane into two, top and bottom

Moving between panes #

Navigate between panes (<C-b>+ arrow keys or <C-b>+q):

tmux select-pane -[U/D/L/R]
CommandExplanation
<C-b>+[↑|↓|→|←]move through panes
<C-b>+ogo to next pane (cycle)
<C-b>+;go to last used pane

Resizing panes #

Resize panes <C-b>+ hold down Ctrl, then use arrow keys:

tmux resize-pane -[U/D/L/R] 10

Zoom in/out of the current pane (<C-b>+z):

tmux resize-pane -Z
CommandExplanation
<C-b>+ Esc+[↑|↓|→|←]Change size of active pane
<C-b>+ Alt+[↑|↓|→|←]Change size of active pane

Command Mode #

Enter command mode (<C-b>+:):

:

Kill a pane or window in command mode:

kill-pane  # (or kill-window)

Miscellaneous #

Show tmux help / list all key bindings (<C-b>+?):

tmux list-keys

Reload tmux configuration:

tmux source-file ~/.tmux.conf

These commands should help you get started with tmux.

Customize the key bindings and settings in your ~/.tmux.conf file to suit your preferences.

Tmux has many features. For advanced usage, see the official documentation.


Further readings #

Sources and recommended, further resources on the topic:

Author

Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See: https://www.j15k.com/

License

License: tmux Cheat Sheet by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/publications/tmux-cheat-sheet">tmux Cheat Sheet</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the DITig legal page.


“Make errors impossible. Making it impossible for the user to make errors is the best way to eliminate error messages.”

Alan Cooper , Software designer and programmerAbout Face, - IT quotes