Basic Usage
Starting and Managing Sessions
- Start a New Session
tmux
- Start a Named Session
tmux new -s mysession
- Attach to a Session
tmux attach -t mysession
- List Sessions
tmux ls
- Detach from a Session
Windows and Panes
- Create a New Window
- Switch Between Windows
- Press
Ctrl + b, then n (next), p (previous), or a window number
- Split Pane Horizontally
- Split Pane Vertically
- Navigate Between Panes
- Press
Ctrl + b, then use the arrow keys
- Resize Panes
- Press
Ctrl + b, then hold Ctrl and use arrow keys
Advanced Usage
Custom Key Bindings
Session Management
Copy and Paste
- Enter Copy Mode
- Start Selection (in Copy Mode)
- Copy Selection (in Copy Mode)
- Paste Clipboard
Examples of Custom Configuration (~/.tmux.conf)
- Set Scrollback Buffer Size
set -g history-limit 10000
- Enable Mouse Support
set -g mouse on
- Change Status Bar Color
set -g status-bg blue
set -g status-fg white
- Set Default Terminal to 256 Colors
set -g default-terminal "screen-256color"
Practical Examples
- Create a New Named Session for a Project
tmux new -s project-name
- Splitting the Window for Monitoring Logs
- Start tmux, then split the pane horizontally (
Ctrl + b, %) and tail logs in one pane while working in the other.
- Using tmux for Remote Pair Programming
- Both users attach to the same tmux session on a server to collaboratively work in real-time.