Tmux - terminal multiplexer cheat sheet Oct 22 2023

The following is a short list of the most common keybindings for the tmux terminal multiplexer.

Starting tmux

1
2
3
4
5
6
7
8
9
|-----------------|-------------------------------------|
| Command         | Description                         |
|-----------------|-------------------------------------|
| tmux            | Start a new session                 |
| tmux new -s name| Start a new session with a name     |
| tmux a          | Attach to the last session          |
| tmux a -t name  | Attach to a named session           |
| tmux ls         | List sessions                       |
|-----------------|-------------------------------------|

Session Management

1
2
3
4
5
6
7
|---------------|--------------------------------------------|
| Command       | Description                                |
|---------------|--------------------------------------------|
| C-b d         | Detach from the current session            |
| C-b $         | Rename the current session                 |
| C-b s         | List sessions (navigate with arrow keys)   |
|---------------|--------------------------------------------|

Windows (Tabs)

1
2
3
4
5
6
7
8
9
10
11
|---------------|--------------------------------------------|
| Command       | Description                                |
|---------------|--------------------------------------------|
| C-b c         | Create a new window                        |
| C-b ,         | Rename the current window                  |
| C-b w         | List windows                               |
| C-b n         | Next window                                |
| C-b p         | Previous window                            |
| C-b 0 to 9    | Go to window number 0-9                    |
| C-b &         | Close the current window                   |
|---------------|--------------------------------------------|

Panes (Splits)

1
2
3
4
5
6
7
8
9
10
11
12
|----------------------------|--------------------------------------------|
| Command                    | Description                                |
|----------------------------|--------------------------------------------|
| C-b %                      | Vertical split                             |
| C-b "                      | Horizontal split                           |
| C-b o                      | Switch to the next pane                    |
| C-b ;                      | Toggle to the last pane                    |
| C-b x                      | Close the current pane                     |
| C-b [Space]                | Toggle pane layouts                        |
| C-b q followed by a number | Quickly select a pane by number            |
| C-b { or C-b }             | Swap panes                                 |
|----------------------------|--------------------------------------------|

Misc Commands

1
2
3
4
5
6
7
8
9
|---------------|--------------------------------------------|
| Command       | Description                                |
|---------------|--------------------------------------------|
| C-b t         | Show the time                              |
| C-b ?         | List all keybindings                       |
| C-b z         | Zoom in/out on a pane                      |
| C-b [ and C-b ] | Enter/Exit copy mode                     |
| C-b :         | Enter command mode                         |
|---------------|--------------------------------------------|

Configuration

~/.tmux.conf is the configuration file for tmux. You can customize settings and keybindings there.

You can see my tmux configuration in my dotfiles


Note: C-b is the default prefix key for tmux, but you can change it in the .tmux.conf configuration file. I prefer to use C-s


** If you want to check what else I'm currently doing, be sure to follow me on twitter @rderik or subscribe to the newsletter. If you want to send me a direct message, you can send it to derik@rderik.com.