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
Command | Explanation |
---|---|
<C-b> +s | list 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
Command | Explanation |
---|---|
<C-b> +c | create new window |
<C-b> +n | go to next window |
<C-b> +p | go to previous window |
<C-b> +[i] | go to [i] window |
<C-b> +' | select the window index |
<C-b> +w | interactive index to choose window (0-9a-z) |
<C-b> +f | find window by name |
<C-b> +l | go 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
Command | Explanation |
---|---|
<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]
Command | Explanation |
---|---|
<C-b> +[↑|↓|→|←] | move through panes |
<C-b> +o | go 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
Command | Explanation |
---|---|
<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:
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.