Quick Start for AI Research

Running long training jobs on remote servers:

1
2
3
4
5
6
7
8
9
10
11
# Start tmux before running long commands
tmux new -s mysession

# Run your training
python train.py --epochs 100

# Detach: Ctrl+b, then d
# Your job keeps running!

# Reconnect later:
tmux attach -t mysession

Why: Your experiments survive SSH disconnects and network issues.

Installation

1
2
3
4
5
# macOS
brew install tmux

# Linux
sudo apt-get install tmux

Key Concepts

  • Sessions - Your workspace (survives disconnects)
  • Windows - Like browser tabs
  • Panes - Split views
  • Prefix - All commands start with Ctrl+b (shown as C-b)

Essential Commands

Sessions

1
2
3
4
tmux new -s name        # Create session
tmux ls # List sessions
tmux a -t name # Attach to session
tmux kill-session -t name # Kill session

Inside tmux:

  • C-b d - Detach
  • C-b s - List/switch sessions

Windows

  • C-b c - Create window
  • C-b , - Rename window
  • C-b n - Next window
  • C-b p - Previous window
  • C-b 0-9 - Go to window #

Panes

  • C-b % - Split vertical
  • C-b " - Split horizontal
  • C-b ←↑↓→ - Navigate panes
  • C-b z - Toggle zoom
  • C-b x - Kill pane

Copy/Scroll Mode

  • C-b [ - Enter copy mode (scroll with arrows, q to exit)
  • C-b ] - Paste

Other

  • C-b ? - Show all keybindings
  • C-b : - Command mode

Basic Config

Create ~/.tmux.conf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Enable mouse
set -g mouse on

# Better split keys
bind | split-window -h
bind - split-window -v

# Increase history
set -g history-limit 10000

# Start windows at 1
set -g base-index 1

# Reload config
bind r source-file ~/.tmux.conf \; display "Reloaded!"

Apply: tmux source-file ~/.tmux.conf or C-b r

Common Use Cases

Training Multiple Models

1
2
3
4
5
6
7
8
9
10
tmux new -s training

# Create windows for each model
C-b c # Window for model1
python train_model1.py
C-b c # Window for model2
python train_model2.py

# Detach and let them run
C-b d

Sync Commands to Multiple Panes

1
2
3
4
5
6
7
8
9
# Split into multiple panes
C-b "
C-b "

# Sync input to all panes
C-b :setw synchronize-panes on

# Now commands go to all panes (useful for running same command on multiple servers)
# Turn off: C-b :setw synchronize-panes off

Quick Reference

Command Action
tmux new -s name Create session
tmux ls List sessions
tmux a -t name Attach session
C-b d Detach
C-b c New window
C-b n/p Next/prev window
C-b % Split vertical
C-b " Split horizontal
C-b ←↑↓→ Navigate panes
C-b z Zoom pane
C-b [ Scroll mode
C-b ? Help