Overview
Tmux (terminal multiplexer) allows you to manage multiple terminal sessions within a single window. This configuration provides a clean, efficient setup with Ctrl+A as the prefix key and mouse support enabled.Features
- Session Management: Persist terminal sessions across disconnections
- Window Splitting: Horizontal and vertical panes
- Mouse Support: Click to switch panes and resize
- Custom Status Bar: Session and window information
- Extensive History: 20,000 lines of scrollback
Installation
- macOS
- Ubuntu/Debian
- Arch Linux
Configuration
Copy the configuration file to your home directory:Basic Concepts
Session
A collection of windows, can be detached and reattached
Window
A full-screen workspace, like a tab in a browser
Pane
A split section within a window
Prefix Key
The configuration changes the default prefix fromCtrl+B to Ctrl+A:
Throughout this documentation,
C-a means Ctrl+A. All tmux commands start with the prefix key.Essential Commands
Session Management
Create and Attach Sessions
Create and Attach Sessions
Detach and Switch Sessions
Detach and Switch Sessions
| Command | Action |
|---|---|
C-a d | Detach from session |
C-a s | List and switch sessions |
C-a $ | Rename session |
C-a ( | Switch to previous session |
C-a ) | Switch to next session |
Window Management
| Command | Action |
|---|---|
C-a c | Create new window |
C-a , | Rename current window |
C-a n | Next window |
C-a p | Previous window |
C-a 0-9 | Switch to window by number |
C-a & | Kill current window |
C-a w | List windows |
Pane Management
- Splitting
- Resizing
- Operations
| Command | Action |
|---|---|
C-a % | Split pane vertically |
C-a " | Split pane horizontally |
Configuration Settings
General Settings
Status Bar Configuration
- Left:
[session_name] - Center: Window list
- Right: Pane title, time, and date
Default Settings
Message and Command Styles
Copy Mode
Tmux has a powerful copy mode for selecting and copying text.Enter Copy Mode
Navigation in Copy Mode
| Key | Action |
|---|---|
↑↓←→ | Move cursor |
Space | Start selection |
Enter | Copy selection |
q | Exit copy mode |
g | Go to top |
G | Go to bottom |
/ | Search forward |
? | Search backward |
n | Next search result |
N | Previous search result |
Paste Buffer
Mouse Support
The configuration enables full mouse support:- Click - Select pane
- Double-click - Select word
- Triple-click - Select line
- Drag - Select text (automatically copied)
- Drag border - Resize pane
- Wheel - Scroll history
Environment Variables
Tmux updates specific environment variables when attaching:Common Workflows
Development Workflow
Split into panes
C-a %- Split vertically (editor | terminal)C-a "- Split bottom pane horizontally (terminal | logs)
SSH Session Persistence
Advanced Configuration
Custom Key Bindings
Add to~/.tmux.conf:
Status Bar Customization
Plugins with TPM
Install Tmux Plugin Manager:~/.tmux.conf:
C-a I
Tips and Tricks
Quick Session Switcher
Quick Session Switcher
Create a shell function:
Synchronize Panes
Synchronize Panes
Send commands to all panes simultaneously:Useful for managing multiple servers.
Zoom Pane
Zoom Pane
Command History
Command History
Troubleshooting
Colors look wrong
Colors look wrong
Add to shell config:Or in
~/.tmux.conf:Mouse scroll enters copy mode
Mouse scroll enters copy mode
This is normal behavior. Press
q to exit copy mode, or configure:Pasting doesn't work
Pasting doesn't work
Ensure you’re in a tmux session:Use
C-a ] to paste from tmux buffer.SSH agent forwarding broken
SSH agent forwarding broken
Fix socket link: