Learn tmux

Interactive hands-on tutorial. Work through each exercise, check off steps as you go, and earn your certification.

7
Exercises
38
Steps
~40
Minutes
🧠
tmux hierarchy:
Session → contains Windows (tabs) → contains Panes (splits)
Splitting a pane creates more panes. It does NOT create new windows or sessions.
01

Sessions

Your project contexts — one session per project

1.1
Create a named session
Launch tmux with a named session. You'll see the green status bar at the bottom — that means you're inside tmux!
terminal command
command
tmux new -s playground
đŸ‘ī¸expected result
A new terminal appears with a green status bar at the bottom: [playground] 0:bash* "your-hostname" 09:00 04-Apr You're now INSIDE tmux.
💡
Try typing the command yourself first! Muscle memory is how you learn keyboard shortcuts.
1.2
Run something inside
Verify you're inside tmux by running a simple command.
terminal command
command
echo "I'm inside tmux!"
đŸ‘ī¸expected result
$ echo "I'm inside tmux!" I'm inside tmux!
1.3
Detach (leave it running)
Press Ctrl+b together, release both, then press d. You'll be back in your normal shell, but the session is still alive in the background!
keyboard shortcut
shortcut
Ctrl+b then d
đŸ‘ī¸expected result
[detached (from session playground)] $ ← you're back in your normal shell
1.4
Verify it's running
List all tmux sessions to confirm your session survived the detach.
terminal command
command
tmux ls
đŸ‘ī¸expected result
playground: 1 windows (created Sat Apr 4 09:00:00 2026)
1.5
Reattach
Jump back into your session. Your previous echo output should still be visible!
terminal command
command
tmux attach -t playground
đŸ‘ī¸expected result
You're back inside tmux! Your previous output is still there. The green status bar at the bottom confirms you're attached.
1.6
Create a second session
From inside tmux, open the command prompt and create another session.
keyboard shortcut
shortcut + command
Ctrl+b then : Type at the prompt: new-session -s project2
đŸ‘ī¸expected result
You're now in the "project2" session. Status bar shows: [project2] 0:bash*
1.7
Switch between sessions
Open the session picker. Use arrow keys to select, Enter to switch.
keyboard shortcut
shortcut
Ctrl+b then s
đŸ‘ī¸expected result
A session list appears: (0) playground: 1 windows (1) project2: 1 windows (attached) Use ↑↓ to select, Enter to switch, q to cancel
1.8
Kill the extra session
Clean up by killing the project2 session.
keyboard shortcut
shortcut + command
Ctrl+b then : Type: kill-session -t project2
đŸ‘ī¸expected result
You're automatically switched back to "playground". The project2 session is gone.
02

Windows

Tabs inside a session — like browser tabs

2.1
Create a new window
Look at the bottom status bar — you'll see two windows listed.
keyboard shortcut
shortcut
Ctrl+b then c
đŸ‘ī¸expected result
Status bar now shows: [playground] 0:bash 1:bash* The * marks your current window (window 1)
2.2
Rename the current window
Give this window a meaningful name. Type "logs" and press Enter.
keyboard shortcut
shortcut
Ctrl+b then , Type: logs then press Enter
đŸ‘ī¸expected result
Status bar now shows: [playground] 0:bash 1:logs*
2.3
Navigate windows
Try all navigation methods. Watch the * move in the status bar.
keyboard shortcut
shortcuts
Ctrl+b then p ← previous window Ctrl+b then n ← next window Ctrl+b then 0 ← jump to window 0 Ctrl+b then 1 ← jump to window 1
đŸ‘ī¸expected result
The * in the status bar moves between windows as you switch.
2.4
Create and close a window
Create a third window, then close it with exit.
keyboard shortcut
commands
Ctrl+b then c ← create window exit ← close it (or Ctrl+d)
đŸ‘ī¸expected result
Window created, then closed. You're back to 2 windows.
03

Panes

Split views within a window — NOT new windows or sessions

â„šī¸
Splitting ≠ creating. When you split, you divide your current pane into two panes. Both panes stay inside the same window, inside the same session. Think of it like splitting a cell in a spreadsheet — you don't create a new spreadsheet.
3.1
Split vertically (left | right)
Split your current pane into two side-by-side panes. Your cursor moves to the new (right) pane.
keyboard shortcut
shortcut
Ctrl+b then %
đŸ‘ī¸expected result
Your terminal splits into two panes side by side: ┌──────────────â”Ŧ──────────────┐ │ │ │ │ left │ right │ │ pane │ pane │ │ │ (cursor │ │ │ here) │ └──────────────┴──────────────┘
3.2
Move between panes
Run different commands in each pane to see they're independent.
keyboard shortcut
shortcuts + commands
# In right pane: echo "I am RIGHT" Ctrl+b then ← ← move to left pane echo "I am LEFT" Ctrl+b then → ← back to right pane
đŸ‘ī¸expected result
Each pane shows different output — they're independent shells.
3.3
Split horizontally (top / bottom)
Split the current pane into top and bottom. Now you have 3 panes!
keyboard shortcut
shortcut
Ctrl+b then "
đŸ‘ī¸expected result
Three panes: ┌──────────────â”Ŧ──────────────┐ │ │ top │ │ left ├──────────────┤ │ │ bottom │ │ │ (cursor) │ └──────────────┴──────────────┘
3.4
Zoom toggle (fullscreen)
Focus on one pane by zooming it to fullscreen. Press again to restore split view.
keyboard shortcut
shortcut
Ctrl+b then z ← zoom in Ctrl+b then z ← zoom out (back to split)
đŸ‘ī¸expected result
Current pane goes fullscreen. Status bar shows a Z flag. Press Ctrl+b z again to restore the split layout.
💡
This is one of the most useful shortcuts! Zoom in for focused work, zoom out to check other panes.
3.5
Close panes
Close panes until you have just one left.
terminal command
command
exit ← or just press Ctrl+d
đŸ‘ī¸expected result
Pane closes. Remaining panes resize automatically. Repeat until you have one pane left.
04

Resize Panes

Adjust pane sizes to your preference

4.1
Create a split to practice on
First, create a vertical split so we have something to resize.
keyboard shortcut
shortcut
Ctrl+b then %
đŸ‘ī¸expected result
Two panes side by side, equal width.
4.2
Resize with keyboard
Hold Ctrl+b, then while still holding Ctrl, press arrow keys to resize.
keyboard shortcut
shortcuts
Ctrl+b then Ctrl+← ← shrink left Ctrl+b then Ctrl+→ ← grow right
đŸ‘ī¸expected result
The divider between panes moves as you press the arrows.
4.3
Precise resize with command
Use the command prompt for exact control. -R = right, -L = left, -U = up, -D = down.
keyboard shortcut
shortcut + command
Ctrl+b then : Type: resize-pane -R 10
đŸ‘ī¸expected result
The divider moves 10 cells to the right.
4.4
Auto-layout
Instantly even out all panes with a layout command.
keyboard shortcut
shortcut + command
Ctrl+b then : Type: select-layout even-horizontal
đŸ‘ī¸expected result
All panes snap to equal widths.
05

Copy Mode

Scroll through output, search, and copy text

5.1
Generate output to scroll through
Print numbers 1-100 so we have something to scroll and search.
terminal command
command
seq 1 100
đŸ‘ī¸expected result
Numbers 1 through 100 printed, one per line. Most will have scrolled past the visible area.
5.2
Enter copy mode & scroll
Enter copy mode to scroll through previous output. Press q to exit.
keyboard shortcut
shortcuts
Ctrl+b then [ ← enter copy mode ↑ ↓ ← scroll line by line PgUp PgDn ← scroll by page q ← exit copy mode
đŸ‘ī¸expected result
Top-right corner shows line position (e.g., [42/100]). You can now scroll through all the output.
5.3
Search in copy mode
Enter copy mode, then search for the number 42.
keyboard shortcut
shortcuts
Ctrl+b then [ ← enter copy mode / ← search forward Type: 42 then press Enter n ← next match N ← previous match
đŸ‘ī¸expected result
The cursor jumps to the line containing "42". The matched text is highlighted.
5.4
Copy text to clipboard
Select and copy text using vi-style keys. This copies to your Windows clipboard!
keyboard shortcut
workflow
Ctrl+b then [ ← enter copy mode Navigate to start of text Space ← start selection Navigate to end of text y ← copy (yank to clipboard!)
đŸ‘ī¸expected result
Selected text is highlighted, then copied when you press y. Paste it anywhere with Ctrl+V to verify!
â„šī¸
Your mouse also works! Your tmux.conf has set -g mouse on, so you can scroll with the wheel and drag to select text.
06

Practical Workflow

Build a real development layout from scratch

6.1
Clean start
Kill all tmux sessions and start completely fresh.
terminal command
commands
# Detach first if inside tmux: Ctrl+b d tmux kill-server tmux new -s dev
đŸ‘ī¸expected result
Fresh tmux session named "dev". Status bar: [dev] 0:bash*
6.2
Build the 3-pane dev layout
You'll create 3 panes by splitting. Each split divides an existing pane into two. You stay in one window the entire time — panes are just split views inside that window.
â„šī¸
Key concept: Splitting does NOT create a new session or window. It splits your current pane into two panes. Both panes live inside the same window.
keyboard shortcut
step-by-step (4 commands)
# Step 1: Rename this window (optional, just for clarity) Ctrl+b then , ← type: dev press Enter # Step 2: Split current pane vertically → creates 2 panes Ctrl+b then % ← your cursor moves to the RIGHT pane # Step 3: Split the RIGHT pane horizontally → now 3 panes Ctrl+b then " ← your cursor moves to the BOTTOM-RIGHT pane # Step 4: Move back to the big left pane Ctrl+b then ←
đŸ‘ī¸what happens at each step
After step 1: You renamed the window (status bar shows "dev" instead of "bash") After step 2 (Ctrl+b %): One pane becomes two side-by-side panes ┌──────────────â”Ŧ──────────────┐ │ │ │ │ pane 0 │ pane 1 │ │ │ (cursor) │ └──────────────┴──────────────┘ After step 3 (Ctrl+b "): The RIGHT pane splits into top/bottom ┌──────────────â”Ŧ──────────────┐ │ │ pane 1 │ │ pane 0 ├──────────────┤ │ │ pane 2 │ │ │ (cursor) │ └──────────────┴──────────────┘ After step 4 (Ctrl+b ←): Cursor moves to pane 0 ┌──────────────â”Ŧ──────────────┐ │ │ pane 1 │ │ pane 0 ├──────────────┤ │ (cursor) │ pane 2 │ │ │ │ └──────────────┴──────────────┘ All 3 panes are inside ONE window, inside ONE session. You use each pane for a different purpose (code, commands, logs) but tmux doesn't care — they're just 3 independent shells.
6.3
Simulate work in each pane
Put different content in each pane to simulate a real workflow.
terminal command
commands (in each pane)
# Left pane (editor) - you should be here: echo "pretend this is vim/code" # Top-right (terminal): Ctrl+b → then Ctrl+b ↑ echo "run commands here" # Bottom-right (logs): Ctrl+b ↓ watch -n 1 date
đŸ‘ī¸expected result
Three panes with different content. Bottom-right shows a live clock.
6.4
Zoom in and out
Practice the zoom workflow: focus on editor, then check logs.
keyboard shortcut
shortcuts
Ctrl+b ← ← focus editor pane Ctrl+b then z ← fullscreen! # ... do focused work ... Ctrl+b then z ← back to split view
đŸ‘ī¸expected result
Pane expands to fullscreen, then restores to split view.
6.5
Detach and reattach
The grand finale: prove that everything persists! Detach, then come back.
keyboard shortcut
commands
Ctrl+b then d ← detach tmux attach -t dev ← come back!
đŸ‘ī¸expected result
Everything is exactly as you left it! All 3 panes, the running clock, your command history — all preserved. That's the power of tmux.
👍
Nice work! You've built a real dev layout. But this was just ONE session with ONE window. In Exercise 7, you'll see what happens when you use multiple sessions, multiple windows, and multiple panes all at once.
07

Real-World Power

Multi-project full-stack workflow — this is why tmux is irreplaceable

đŸ—ī¸
The scenario: You're working on a full-stack app. Backend API, frontend UI, and you need system monitoring. You'll manage it all from one terminal using 3 sessions, multiple windows, and panes — then prove everything survives a terminal crash.
7.1
Clean slate
Kill everything from previous exercises. Start completely fresh.
terminal command
commands
# If inside tmux, detach first: Ctrl+b d tmux kill-server
đŸ‘ī¸expected result
All tmux sessions are gone. You're in a plain shell. $ tmux ls no server running on /tmp/tmux-1000/default
7.2
Create the backend session
Create a session for your backend API. Rename the window and simulate a running server.
terminal command
commands
tmux new -s backend # Now inside the "backend" session. Rename the window: Ctrl+b then , ← type: server press Enter # Simulate a running API server: watch -n 2 'echo "=== Backend API ===" && echo "Status: RUNNING" && echo "Port: 3000" && echo "Uptime: $(uptime -p)"'
đŸ‘ī¸expected result
Status bar: [backend] 0:server* Screen refreshes every 2 seconds showing: === Backend API === Status: RUNNING Port: 3000 Uptime: up 2 hours, 15 minutes
7.3
Add a logs window to backend
Create a second window in the backend session for watching logs. Now you have 2 windows (tabs) in one session.
keyboard shortcut
shortcuts + commands
Ctrl+b then c ← create new window Ctrl+b then , ← rename to: logs # Simulate log output: watch -n 1 'echo "[$(date +%H:%M:%S)] GET /api/users 200 12ms" && echo "[$(date +%H:%M:%S)] POST /api/data 201 45ms" && echo "[$(date +%H:%M:%S)] GET /api/health 200 2ms"'
đŸ‘ī¸expected result
Status bar now shows TWO windows: [backend] 0:server 1:logs* You can switch between them: Ctrl+b 0 → server (watch running) Ctrl+b 1 → logs (watch running) Both keep running even when you're not looking!
💡
Key insight: Both windows run independently. The server keeps "running" in window 0 while you view logs in window 1. This is like having two browser tabs.
7.4
Create the frontend session
Create a completely separate session for frontend work. This is a new session, not a window — it's isolated from backend.
keyboard shortcut
shortcuts + commands
Ctrl+b then : ← open command prompt new-session -s frontend ← creates AND switches to new session Ctrl+b then , ← rename window to: app # Simulate a frontend dev server: watch -n 2 'echo "=== Frontend Dev Server ===" && echo "Status: RUNNING" && echo "URL: http://localhost:5173" && echo "HMR: active"'
đŸ‘ī¸expected result
Status bar changed — you're in a different session now: [frontend] 0:app* The backend session is still alive in the background! Its server and logs are still running.
7.5
Create the monitoring session with 4-pane grid
Create a third session for system monitoring. Build a 4-pane grid — this uses everything you've learned.
keyboard shortcut
step-by-step
# Create the monitoring session Ctrl+b then : new-session -s monitoring Ctrl+b then , ← rename to: dashboard # Build a 4-pane grid: Ctrl+b % ← split vertical (2 panes) Ctrl+b " ← split right pane horizontal (3 panes) Ctrl+b ← ← move to left pane Ctrl+b " ← split left pane horizontal (4 panes!) # Now fill each pane with a monitoring tool: # You're in bottom-left. Run: watch -n 5 'df -h | head -5' Ctrl+b ↑ ← move to top-left top Ctrl+b → ← move to top-right watch -n 3 free -h Ctrl+b ↓ ← move to bottom-right watch -n 5 'echo "=== System ===" && uptime && echo "" && echo "=== Network ===" && ip -brief addr 2>/dev/null || hostname -I'
đŸ‘ī¸expected result
Your monitoring dashboard: ┌───────────────────â”Ŧ──────────────────┐ │ top │ watch free -h │ │ (CPU/processes) │ (memory usage) │ ├───────────────────â”ŧ──────────────────┤ │ watch df -h │ system/network │ │ (disk usage) │ info │ └───────────────────┴──────────────────┘ All 4 panes updating live — a real monitoring dashboard!
7.6
Rapid switching between sessions
Now the magic — jump between your 3 sessions instantly. You have a backend API, frontend dev server, and monitoring dashboard all running simultaneously.
keyboard shortcut
shortcuts
# Session picker — see ALL sessions at once: Ctrl+b then s # Window picker — see ALL windows across ALL sessions: Ctrl+b then w # Try switching: monitoring → backend → frontend → monitoring # Each session preserved its state perfectly.
đŸ‘ī¸expected result
Session picker (Ctrl+b s) shows: (0) + backend: 2 windows (1) + frontend: 1 windows (2) + monitoring: 1 windows (attached) Window picker (Ctrl+b w) shows EVERYTHING: (0) + backend: 2 windows (0) 0: server (1 panes) (1) 1: logs (1 panes) (1) + frontend: 1 windows (2) 0: app (1 panes) (2) + monitoring: 1 windows (3) 0: dashboard (4 panes) Use ↑↓ to navigate, Enter to jump to any window in any session!
đŸ”Ĩ
This is tmux's superpower. You're running 3 projects, 4 windows, and 7 panes — all from ONE terminal. Switch between them in under a second. No alt-tabbing, no searching for windows.
7.7
Detach and prove persistence
Detach from everything. Then check — all 3 sessions should still be running.
keyboard shortcut
commands
Ctrl+b then d ← detach tmux ls ← list all sessions
đŸ‘ī¸expected result
$ tmux ls backend: 2 windows (created ...) frontend: 1 windows (created ...) monitoring: 1 windows (created ...) All 3 sessions alive! All processes still running! Reattach to any one: $ tmux attach -t backend
7.8
The "crash test" — close your terminal entirely
The ultimate test. Close your terminal window completely (not just detach — actually close it). Then open a brand new terminal and check.
terminal command
steps
# 1. Make sure you're detached (Ctrl+b d if inside tmux) # 2. CLOSE this terminal window entirely (click X or type exit) # 3. Open a brand new terminal # 4. Check: tmux ls # 5. Reattach to monitoring dashboard: tmux attach -t monitoring
đŸ‘ī¸expected result
All 3 sessions survived the "crash"! top is still running. Logs are still tailing. Servers are still up. Nothing was lost. This is exactly what happens when your SSH connection drops, your laptop sleeps, or your terminal app crashes. tmux keeps everything alive.
🎉
You've mastered tmux! You just built a multi-project workspace with 3 sessions, 4 windows, and 7 panes — and proved it survives terminal crashes. This is how senior developers use tmux every day on remote servers, cloud VMs, and multi-service architectures.
🏆
tmux Certified
Certificate of Completion
Sessions Windows Panes Resize Copy Mode Dev Workflow Multi-Project Power

You've mastered the essential tmux skills. Go forth and multiplex!