General Questions
What is tmux and why should I use it?
What is tmux and why should I use it?
- Create multiple terminal sessions from a single window
- Detach from sessions and reattach later (useful for remote work)
- Split your terminal into multiple panes
- Share sessions between users
- Persist terminal sessions across SSH disconnections
What's the difference between a session, window, and pane?
What's the difference between a session, window, and pane?
- Session: The top-level container. You can attach to and detach from sessions. A session contains one or more windows.
- Window: Similar to tabs in a web browser. Each window has a name and fills the entire terminal. A window contains one or more panes.
- Pane: A split section of a window that runs a single terminal instance. Panes divide a window into multiple sections.
Session → Window → PaneHow do I pronounce tmux?
How do I pronounce tmux?
Getting Started
How do I start tmux?
How do I start tmux?
How do I exit tmux?
How do I exit tmux?
- Detach (keeps session running): Press
C-b dor runtmux detach - Kill session (destroys session): Press
C-b :then typekill-session - Exit shell: Type
exitor pressC-din each pane until all panes are closed
How do I reattach to a session?
How do I reattach to a session?
Key Bindings
What is the prefix key and how do I change it?
What is the prefix key and how do I change it?
C-b, Control-b) is pressed before most tmux commands. To change it, add this to ~/.tmux.conf:C-a as it’s easier to type and matches GNU Screen’s default.How do I split panes?
How do I split panes?
- Vertical split (side by side):
C-b % - Horizontal split (top and bottom):
C-b "
How do I navigate between panes?
How do I navigate between panes?
How do I resize panes?
How do I resize panes?
- Hold
C-bthen press and hold an arrow key, or C-b C-Up/Down/Left/Right(repeatable)C-b M-Up/Down/Left/Right(resize by 5 cells, repeatable)
Configuration
Where is the tmux configuration file?
Where is the tmux configuration file?
~/.config/tmux/tmux.conf~/.tmux.conf
How do I reload my configuration?
How do I reload my configuration?
How do I enable true color support?
How do I enable true color support?
~/.tmux.conf:How do I enable mouse support?
How do I enable mouse support?
- Clicking to select panes
- Dragging pane borders to resize
- Clicking windows in status bar
- Scrolling with mouse wheel
Copy Mode and Clipboard
How do I copy text in tmux?
How do I copy text in tmux?
- Enter copy mode:
C-b [ - Navigate to start of text
- Begin selection:
Space(vi mode) orC-Space(emacs mode) - Navigate to end of text
- Copy:
Enter(vi mode) orM-w(emacs mode) - Paste:
C-b ]
- Click and drag to select
- Double-click to select word
- Triple-click to select line
How do I use vi key bindings in copy mode?
How do I use vi key bindings in copy mode?
How do I integrate tmux with system clipboard?
How do I integrate tmux with system clipboard?
Why can't I scroll with my mouse wheel?
Why can't I scroll with my mouse wheel?
- Some applications need to enable alternate screen buffer
- Try holding Shift while scrolling to scroll the terminal history
- In alternate screen mode, scrolling is sent to the application
Session Management
How do I switch between sessions?
How do I switch between sessions?
- List sessions:
C-b s(choose from list) - Switch to last session:
C-b L - Switch to next session:
C-b ) - Switch to previous session:
C-b (
How do I rename a session or window?
How do I rename a session or window?
- Rename session:
C-b $ - Rename window:
C-b ,
How do I prevent automatic window renaming?
How do I prevent automatic window renaming?
How do I share a session with another user?
How do I share a session with another user?
Troubleshooting
Why do my colors look wrong?
Why do my colors look wrong?
-
Wrong TERM value: Set in your config:
-
Missing terminfo: On some systems, install
tmux-256colorterminfo - Outer terminal doesn’t support colors: Check your terminal emulator settings
- No true color support: Add terminal-overrides as shown in the configuration section
Why is my escape key so slow in vim?
Why is my escape key so slow in vim?
escape-time to determine if Escape is part of a function key sequence. Reduce the timeout:Why doesn't my .bashrc / .zshrc get sourced?
Why doesn't my .bashrc / .zshrc get sourced?
How do I see the tmux server log?
How do I see the tmux server log?
~/tmux-client-*.log and ~/tmux-server-*.log.Why do my environment variables not update?
Why do my environment variables not update?
Can I run tmux inside tmux?
Can I run tmux inside tmux?
$TMUX variable is set unless you use:Advanced Usage
How do I script tmux session creation?
How do I script tmux session creation?
How do I customize the status bar?
How do I customize the status bar?
How do I use tmux with SSH?
How do I use tmux with SSH?
.bashrc or .zshrc:How do I run a command in all panes?
How do I run a command in all panes?
Performance
Can tmux handle large amounts of scrollback?
Can tmux handle large amounts of scrollback?
Does tmux work over slow connections?
Does tmux work over slow connections?
- Sessions persist through disconnections
- Only screen updates are sent (efficient protocol)
- You can reduce status bar updates to save bandwidth: