📖 Guide
Tmux — Complete Reference
Comprehensive tmux cheat sheet covering sessions, windows, panes, copy mode, configuration, plugins, and common workflows.
68 commands across 9 categories
Session ManagementWindow ManagementPane ManagementNavigationCopy ModeConfigurationStatus BarPluginsCommon Workflows
Session Management
| Command | Description |
|---|---|
tmux new -s name | Create a new named session |
tmux ls | List all sessions |
tmux attach -t name | Attach to a named session |
tmux kill-session -t name | Kill a specific session |
Ctrl+b d | Detach from current session |
Ctrl+b $ | Rename current session |
tmux kill-server | Kill all sessions and the tmux server |
Ctrl+b s | Show session picker (interactive list) |
tmux new -s name -d | Create a new session in the background (detached) |
Window Management
| Command | Description |
|---|---|
Ctrl+b c | Create a new window |
Ctrl+b , | Rename current window |
Ctrl+b & | Close current window (with confirmation) |
Ctrl+b w | List all windows (interactive picker) |
Ctrl+b n | Move to next window |
Ctrl+b p | Move to previous window |
Ctrl+b 0-9 | Switch to window by number |
tmux swap-window -t 0 | Swap current window with window 0 |
Ctrl+b f | Find window by name |
Pane Management
| Command | Description |
|---|---|
Ctrl+b % | Split pane vertically (left/right) |
Ctrl+b " | Split pane horizontally (top/bottom) |
Ctrl+b x | Close current pane (with confirmation) |
Ctrl+b z | Toggle pane zoom (fullscreen) |
Ctrl+b { | Move current pane left |
Ctrl+b } | Move current pane right |
Ctrl+b Space | Cycle through pane layouts |
Ctrl+b ! | Convert pane into a new window |
Ctrl+b q | Show pane numbers, then press number to switch |
Copy Mode
| Command | Description |
|---|---|
Ctrl+b [ | Enter copy mode (scroll/select text) |
q | Exit copy mode |
Space | Start selection (in copy mode) |
Enter | Copy selection and exit copy mode |
Ctrl+b ] | Paste copied text |
/ | Search forward in copy mode |
? | Search backward in copy mode |
setw -g mode-keys vie.g. Add to ~/.tmux.conf for persistent vi bindings | Use vi-style keys in copy mode |
Configuration
| Command | Description |
|---|---|
Ctrl+b : | Open tmux command prompt |
tmux source-file ~/.tmux.conf | Reload tmux configuration |
set -g mouse on | Enable mouse support (scrolling, clicking, resizing) |
set -g base-index 1 | Start window numbering at 1 instead of 0 |
set -g default-terminal 'screen-256color' | Enable 256-color support |
set -g history-limit 10000 | Set scrollback buffer size |
set -sg escape-time 0 | Remove delay after pressing Escape (useful for vim) |
bind r source-file ~/.tmux.confe.g. Ctrl+b r will reload after adding this | Bind r to reload config |
Status Bar
| Command | Description |
|---|---|
set -g status on | Enable status bar |
set -g status off | Disable status bar |
set -g status-position top | Move status bar to top of screen |
set -g status-interval 5 | Set status bar refresh interval (seconds) |
set -g status-style 'bg=black,fg=white' | Set status bar colors |
set -g status-right "%H:%M %d-%b-%y" | Customize right side of status bar |
Plugins
| Command | Description |
|---|---|
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | Install TPM (Tmux Plugin Manager) |
set -g @plugin 'tmux-plugins/tpm' | Add TPM to tmux.conf |
set -g @plugin 'tmux-plugins/tmux-resurrect' | Add tmux-resurrect (save/restore sessions across restarts) |
set -g @plugin 'tmux-plugins/tmux-sensible' | Add tmux-sensible (good default settings) |
Ctrl+b I | Install plugins listed in tmux.conf (via TPM) |
Ctrl+b U | Update all plugins (via TPM) |
Common Workflows
| Command | Description |
|---|---|
tmux new -s dev -d && tmux send-keys -t dev 'vim .' Enter | Create a detached session and run a command in it |
tmux pipe-pane -o 'cat >> ~/tmux.log' | Log all output from current pane to a file |
Ctrl+b : join-pane -t :1 | Move current pane to window 1 |
tmux capture-pane -pS -1000 > output.txt | Capture last 1000 lines of pane output to file |
tmux set synchronize-panes on | Send keystrokes to all panes simultaneously |
tmux display-message -p '#S:#I.#P' | Print current session:window.pane identifiers |
📖 Free, searchable command reference. Bookmark this page for quick access.