tmux keyboard shortcuts
tmux is a terminal multiplexer: windows, split panes and sessions that keep running after you disconnect. Every command starts with the prefix, Ctrl+B by default, followed by a key.
Most used tmux keyboard shortcuts
The tmux shortcuts worth learning first. The full list follows, grouped by task.
- Detach from the sessionMacCtrlB,DLinuxCtrlB,D
- Create a new windowMacCtrlB,CLinuxCtrlB,C
- Next windowMacCtrlB,NLinuxCtrlB,N
- Split the pane left and rightMacCtrlB,Shift5LinuxCtrlB,Shift5
- Split the pane top and bottomMacCtrlB,Shift'LinuxCtrlB,Shift'
- Zoom or unzoom the paneMacCtrlB,ZLinuxCtrlB,Z
- Enter copy mode (scroll back)MacCtrlB,[LinuxCtrlB,[
Sessions
5 shortcuts| Action | Mac | Linux |
|---|---|---|
| Detach from the session | CtrlB,D | CtrlB,D |
| Choose a session from a list | CtrlB,S | CtrlB,S |
| Rename the session | CtrlB,Shift4 | CtrlB,Shift4 |
| Next session | CtrlB,Shift0 | CtrlB,Shift0 |
| Previous session | CtrlB,Shift9 | CtrlB,Shift9 |
Windows
8 shortcuts| Action | Mac | Linux |
|---|---|---|
| Create a new window | CtrlB,C | CtrlB,C |
| Next window | CtrlB,N | CtrlB,N |
| Previous window | CtrlB,P | CtrlB,P |
| Go to window 0 to 9 | CtrlB,0 | CtrlB,0 |
| Last used window | CtrlB,L | CtrlB,L |
| Choose a window from a list | CtrlB,W | CtrlB,W |
| Rename the window | CtrlB,, | CtrlB,, |
| Kill the window | CtrlB,Shift7 | CtrlB,Shift7 |
Panes
13 shortcuts| Action | Mac | Linux |
|---|---|---|
| Split the pane left and right | CtrlB,Shift5 | CtrlB,Shift5 |
| Split the pane top and bottom | CtrlB,Shift' | CtrlB,Shift' |
| Move to the pane in a direction | CtrlB,←orCtrlB,→orCtrlB,↑orCtrlB,↓ | CtrlB,←orCtrlB,→orCtrlB,↑orCtrlB,↓ |
| Next pane | CtrlB,O | CtrlB,O |
| Last used pane | CtrlB,; | CtrlB,; |
| Zoom or unzoom the pane | CtrlB,Z | CtrlB,Z |
| Kill the pane | CtrlB,X | CtrlB,X |
| Show pane numbers | CtrlB,Q | CtrlB,Q |
| Swap with the next pane | CtrlB,Shift] | CtrlB,Shift] |
| Swap with the previous pane | CtrlB,Shift[ | CtrlB,Shift[ |
| Move the pane to its own window | CtrlB,Shift1 | CtrlB,Shift1 |
| Cycle pane layouts | CtrlB,Space | CtrlB,Space |
| Resize the pane | CtrlB,Ctrl↑orCtrlB,Ctrl↓orCtrlB,Ctrl←orCtrlB,Ctrl→ | CtrlB,Ctrl↑orCtrlB,Ctrl↓orCtrlB,Ctrl←orCtrlB,Ctrl→ |
Copy mode and misc
5 shortcuts| Action | Mac | Linux |
|---|---|---|
| Enter copy mode (scroll back) | CtrlB,[ | CtrlB,[ |
| Paste the copy buffer | CtrlB,] | CtrlB,] |
| Open the tmux command prompt | CtrlB,Shift; | CtrlB,Shift; |
| List key bindings | CtrlB,Shift/ | CtrlB,Shift/ |
| Show a big clock | CtrlB,T | CtrlB,T |
No shortcuts match. Try fewer words, the key names only, or search every app.
Show the key map: which keys tmux uses mostDarker orange = used by more shortcuts
How the tmux prefix works
Press Ctrl+B, let go, then press the command key. Ctrl+B then C means: hold Ctrl and press B, release both, then press C.
- Change the prefix
- Many people use Ctrl+A. Add set -g prefix C-a, unbind C-b and bind C-a send-prefix to ~/.tmux.conf, then reload it.
- List every binding
- Ctrl+B then ? shows all key bindings in the current tmux, including your own.
tmux session shortcuts: new, detach, switch and kill
- Choose a session from a listMacCtrlB,SLinuxCtrlB,S
- Rename the sessionMacCtrlB,Shift4LinuxCtrlB,Shift4
- Next sessionMacCtrlB,Shift0LinuxCtrlB,Shift0
- Previous sessionMacCtrlB,Shift9LinuxCtrlB,Shift9
- New session
- From a shell, tmux new -s name starts a named session. Inside tmux, prefix then :new and Enter starts another.
- Kill a session
- Run tmux kill-session -t name, or prefix then :kill-session inside it. Closing its last window ends it too.
Create and switch windows in tmux
- Go to window 0 to 9MacCtrlB,0LinuxCtrlB,0
- Last used windowMacCtrlB,LLinuxCtrlB,L
- Choose a window from a listMacCtrlB,WLinuxCtrlB,W
- Rename the windowMacCtrlB,,LinuxCtrlB,,
- Kill the windowMacCtrlB,Shift7LinuxCtrlB,Shift7
Split panes, switch panes and close them in tmux
- Next paneMacCtrlB,OLinuxCtrlB,O
- Last used paneMacCtrlB,;LinuxCtrlB,;
- Kill the paneMacCtrlB,XLinuxCtrlB,X
- Show pane numbersMacCtrlB,QLinuxCtrlB,Q
- Swap with the next paneMacCtrlB,Shift]LinuxCtrlB,Shift]
- Swap with the previous paneMacCtrlB,Shift[LinuxCtrlB,Shift[
- Move the pane to its own windowMacCtrlB,Shift1LinuxCtrlB,Shift1
- Cycle pane layoutsMacCtrlB,SpaceLinuxCtrlB,Space
- Resize the paneMacCtrlB,Ctrl↑orCtrlB,Ctrl↓orCtrlB,Ctrl←orCtrlB,Ctrl→LinuxCtrlB,Ctrl↑orCtrlB,Ctrl↓orCtrlB,Ctrl←orCtrlB,Ctrl→
Scroll up and copy text in tmux
- Paste the copy bufferMacCtrlB,]LinuxCtrlB,]
- Open the tmux command promptMacCtrlB,Shift;LinuxCtrlB,Shift;
- List key bindingsMacCtrlB,Shift/LinuxCtrlB,Shift/
- Show a big clockMacCtrlB,TLinuxCtrlB,T
- Scroll up
- Prefix then [ enters copy mode: scroll with the arrow keys or Page Up, and press q to leave. Add set -g mouse on to ~/.tmux.conf to scroll with the mouse wheel.
Change the tmux prefix and key bindings
- Use Ctrl+A as the prefix
- Add set -g prefix C-a, unbind C-b and bind C-a send-prefix to ~/.tmux.conf, then reload it with tmux source-file ~/.tmux.conf.
- List every binding
- Prefix then ? shows all keys inside tmux, and tmux list-keys prints them in a shell.
tmux keyboard shortcuts: questions
- Why are tmux shortcuts not working?
- Press the prefix (Ctrl+B), let go, then press the key; holding Ctrl for both does something else. A custom ~/.tmux.conf may have changed the prefix: tmux show -g prefix shows it. On a Mac, keys with Option need the terminal set to use Option as Meta.
These are the default key bindings in tmux 3.5, as published by tmux project. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.
Single-system lists: tmux keyboard shortcuts for Mac, tmux keyboard shortcuts for Linux.
Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.