Starting tmux
The simplest way to start tmux is to run it without any arguments:- Creates a new session with a single window
- Displays a status line at the bottom showing session information
- Starts your default shell in the window
Creating Named Sessions
It’s useful to name your sessions for easier management:The Prefix Key
tmux is controlled using a key combination of a prefix key followed by a command key. The default prefix isC-b (Ctrl-b).
To send a command to tmux, press the prefix key first, release it, then press the command key.
Common Commands
After pressing the prefix key (C-b), you can use these commands:
| Key | Action |
|---|---|
? | List all key bindings |
: | Enter the tmux command prompt |
d | Detach from the current session |
c | Create a new window |
[ | Enter copy mode |
] | Paste the most recently copied text |
Sessions
A session is a single collection of pseudo terminals under tmux management. Sessions persist even when you disconnect.Windows
Each session has one or more windows. A window occupies the entire screen and may be split into panes.Window Navigation
| Keys | Action |
|---|---|
C-b c | Create a new window |
C-b n | Move to the next window |
C-b p | Move to the previous window |
C-b l | Move to the previously selected window |
C-b 0-9 | Select windows 0 to 9 |
C-b ' | Prompt for window index to select |
C-b w | Choose window interactively |
C-b f | Prompt to search for text in open windows |
Window Management
C-b ,- Rename the current windowC-b &- Kill the current window (with confirmation)
Basic Panes
Panes allow you to divide a window into multiple sections.Creating Panes
| Keys | Action |
|---|---|
C-b " | Split the current pane horizontally (top and bottom) |
C-b % | Split the current pane vertically (left and right) |
Navigating Panes
| Keys | Action |
|---|---|
C-b o | Select the next pane |
C-b ; | Move to the previously active pane |
C-b Up/Down/Left/Right | Change to the pane in that direction |
C-b q | Briefly display pane indexes |
The Command Prompt
PressC-b : to enter the command prompt. This allows you to run any tmux command interactively.
Examples:
Getting Help
- Key Bindings
- Command List
- Manual Page
Press
C-b ? to see a list of all key bindings.Configuration File
tmux loads configuration from:/etc/tmux.conf(system-wide, if present)~/.tmux.confor$XDG_CONFIG_HOME/tmux/tmux.conf(user-specific)
Basic Configuration Example
Reloading Configuration
After editing your configuration file:C-b R to reload.
Common Workflows
Development Session
Create a development environment with multiple windows:Remote Server Management
Default Key Bindings Reference
Here’s a complete reference of the default key bindings (all require pressingC-b first):
Session Management
Session Management
d- Detach from sessionD- Choose a client to detachs- Select a new session interactively$- Rename the current session(- Switch to previous session)- Switch to next sessionL- Switch to last session
Window Management
Window Management
c- Create a new window&- Kill the current windown- Move to next windowp- Move to previous windowl- Move to previously selected window0-9- Select windows 0 to 9'- Prompt for window index,- Rename current window.- Prompt for window index to movew- Choose window interactivelyf- Search for text in windows
Pane Management
Pane Management
"- Split pane horizontally%- Split pane verticallyo- Select next pane;- Move to previously active paneq- Show pane numbersx- Kill current panez- Toggle pane zoom!- Break pane into window{- Swap with previous pane}- Swap with next paneUp/Down/Left/Right- Move to pane in directionC-Up/C-Down/C-Left/C-Right- Resize pane by 1 cellM-Up/M-Down/M-Left/M-Right- Resize pane by 5 cellsSpace- Cycle through preset layoutsM-1toM-7- Arrange in preset layouts
Copy Mode and Other
Copy Mode and Other
[- Enter copy mode]- Paste buffer#- List paste buffers=- Choose buffer to paste interactively-- Delete most recent paste buffer:- Enter command prompt?- List key bindingst- Show timei- Display window information~- Show previous messagesr- Force redrawC-z- Suspend tmux client