1. The Core Concept
Everything in tmux relies on a Prefix Key. By default, this is Ctrl + b.
You press Ctrl and b together, release them, and then press the command key.
2. Quick Cheat Sheet
Session Management (Run these in the terminal)
| Goal | Command |
|---|---|
| Start new session | tmux new -s training (Name it so you can find it later) |
| Detach (Leave running) | Press Ctrl+b then d |
| List running sessions | tmux ls |
| Re-attach to session | tmux attach -t training |
| Kill a session | tmux kill-session -t training |
Window (Tab) Management (Inside tmux)
| Goal | Shortcut (Press Ctrl+b first!) |
|---|---|
| New Window | c |
| Close Window | & (or type exit in the shell) |
| Next Window | n |
| Previous Window | p |
| Rename Window | , |
Pane (Split) Management (Inside tmux)
| Goal | Shortcut (Press Ctrl+b first!) |
|---|---|
| Split Vertically | % (Shift + 5) |
| Split Horizontally | " (Shift + ‘) |
| Move Focus | Arrow Keys |
| Zoom Pane | z (Makes current pane fullscreen; press again to unzoom) |
| Scroll Mode | [ (Then use arrows/PgUp to scroll. Press q to quit) |
3. The “Training Dashboard” Workflow
Since you have 8 GPUs, you shouldn’t just run the script. You should monitor it. Here is how to set up a professional view:
- Create the session:
1tmux new -s qwen_train - Split the screen horizontally (Press
Ctrl+bthen"). - Resize the bottom pane to be smaller (Press
Ctrl+bthen holdAlt+Down Arrowif supported, or just drag the line if mouse is enabled). - In the top pane: Run your training script.
- In the bottom pane: Run
watch -n 1 nvidia-smito monitor VRAM and Usage. - Detach (
Ctrl+bthend) when you want to disconnect SSH. The training keeps running.
4. Essential Configuration (Enable Mouse)
By default, you cannot click to switch panes or scroll with your mouse wheel in tmux.
Create a file named ~/.tmux.conf in your home directory and paste this in. It makes tmux behave like a modern terminal.
1# ~/.tmux.conf
2
3# Enable mouse control (clickable windows, panes, resizable panes)
4set -g mouse on
5
6# Increase scrollback buffer size (essential for reading long training logs)
7set -g history-limit 50000
8
9# Improve colors
10set -g default-terminal "screen-256color"
11
12# Start window numbering at 1 (easier to reach on keyboard)
13set -g base-index 1
14setw -g pane-base-index 1
15
16# Reload config file with 'r'
17bind r source-file ~/.tmux.conf
After saving this file:
Run tmux source ~/.tmux.conf (inside tmux) or restart your tmux server (tmux kill-server) for changes to take effect.