Cheatsheet Tmux
🖥️ Tmux Cheatsheet
Table of Contents
Sessions
| Description | Shell Command | Tmux Command | Shortcut |
|---|---|---|---|
| Start a new session | tmux, tmux new, tmux new-session | new | |
| Start a new session named mysession | tmux new -s mysession | new -s mysession | |
| Rename session | Ctrl + b $ | ||
| Detach from session | Ctrl + b d | ||
| Show all sessions | tmux ls, tmux list-sessions | Ctrl + b s | |
| Attach to last session | tmux a, tmux at, tmux attach, tmux attach-session | ||
| Attach to session mysession | tmux a -t mysession, tmux at -t mysession, tmux attach -t mysession, tmux attach-session -t mysession | ||
| Kill/delete session mysession | tmux kill-ses -t mysession, tmux kill-session -t mysession | ||
| Kill all sessions but the current | tmux kill-session -a | ||
| Kill all sessions but mysession | tmux kill-session -a -t mysession | ||
| Move to previous session | Ctrl + b ( | ||
| Move to next session | Ctrl + b ) |
Windows
| Description | Shell Command | Tmux Command | Shortcut |
|---|---|---|---|
| Create window | Ctrl + b c | ||
| Rename current window | Ctrl + b , | ||
| Close current window | Ctrl + b & | ||
| List windows | Ctrl + b w | ||
| Previous window | Ctrl + b p | ||
| Next window | Ctrl + b n | ||
| Switch/select window by number | Ctrl + b 0…9 | ||
| Toggle last active window | Ctrl + b l | ||
| Reorder window, swap window 2 and 1 | swap-window -s 2 -t 1 | ||
| Move current window to the left | swap-window -t -1 |
Panes
| Description | Shell Command | Tmux Command | Shortcut |
|---|---|---|---|
| Split pane horizontally | split-window -h | Ctrl + b % | |
| Split pane vertically | split-window -v | Ctrl + b " | |
| Switch to pane in direction | Ctrl + b ↑/↓/←/→ | ||
| Toggle between pane layouts | Ctrl + b Space | ||
| Show pane numbers | Ctrl + b q | ||
| Switch/select pane by number | Ctrl + b q 0…9 | ||
| Toggle pane zoom | Ctrl + b z | ||
| Convert pane into a window | Ctrl + b ! | ||
| Resize pane height | Ctrl + b ↑/↓ (hold) | ||
| Resize pane width | Ctrl + b ←/→ (hold) | ||
| Close current pane | Ctrl + b x |
Copy Mode
| Description | Shell Command | Tmux Command | Shortcut |
|---|---|---|---|
| Enter copy mode | Ctrl + b [ | ||
| Enter copy mode and scroll up | Ctrl + b PgUp | ||
| Quit mode | q | ||
| Go to top line | g | ||
| Go to bottom line | G | ||
| Move cursor | h/j/k/l | ||
| Start selection | Space | ||
| Clear selection | Esc | ||
| Copy selection | Enter | ||
| Paste contents of buffer_0 | Ctrl + b ] |
Misc
| Description | Shell Command | Tmux Command | Shortcut |
|---|---|---|---|
| Enter command mode | Ctrl + b : | ||
| Enable mouse mode | set mouse on |
Help
| Description | Shell Command | Tmux Command | Shortcut |
|---|---|---|---|
| List key bindings | tmux list-keys | list-keys | Ctrl + b ? |
| Show every session, window, pane, etc. | tmux info |
This post is licensed under CC BY 4.0 by the author.