Install
On macOS, install tmux via brew:
- brew search tmux
- brew info tmux
- brew install tmux
Config
Use the popular configuration found on GitHub, and follow the tutorial to install it.
Basic Concepts
- Session
- window
- pane
Introduction to the basic concepts
Understanding oh-my-tmux Configuration
Global settings: the prefix binding key defaults to Ctrl+b, which is inconvenient to use. oh-my-tmux additionally binds Ctrl+a as the prefix key.
Session Operations
| Operation | Command | Description |
|---|---|---|
| New session | tmux new -s demo | Create a session named demo |
| Check current session list | tmux list-session /tmux ls | List all current sessions; view only, no switching |
| Switch session | prefix s | List all sessions; use j/k keys to switch |
| rename session | prefix $ | |
| kill-session | tmux kill-session -t demo | close demo session |
| kill-server | tmux kill-server | close server, everything gone |
| attach-session | tmux attach-session -t sessionName |
Window Operations
A window is usually split into multiple panes, though it defaults to a single pane. Similar to a Tab in iTerm.
| Operation | Command | Description |
|---|---|---|
| New window | prefix c | Create a new window |
| Switch window | prefix number | e.g. switch to window 2: prefix 2 |
| Close current window | prefix & | |
| List all windows | tmux list-window | Show all windows, marking the active window |
Pane Operations
| Operation | Command | Description |
---|---|--- | Split window or pane horizontally | prefix - | Split a window or pane horizontally into two equal parts, similar to sp | | Split window or pane vertically | prefix _ | Similar to vs | | Temporarily maximize a pane | prefix z | The pane fills the entire window; run again to restore | | Show pane numbers | prefix q | |