Launch tmux with a named session. You'll see the green status bar at the bottom â that means you're inside tmux!
terminal command
A new terminal appears with a green status bar at the bottom:
[playground] 0:bash* "your-hostname" 09:00 04-Apr
đĄTry typing the command yourself first! Muscle memory is how you learn keyboard shortcuts.
Verify you're inside tmux by running a simple command.
terminal command
$ echo "I'm inside tmux!"
I'm inside tmux!
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
[detached (from session playground)]
$
List all tmux sessions to confirm your session survived the detach.
terminal command
playground: 1 windows (created Sat Apr 4 09:00:00 2026)
Jump back into your session. Your previous echo output should still be visible!
terminal command
tmux attach -t playground
You're back inside tmux! Your previous output is still there.
From inside tmux, open the command prompt and create another session.
keyboard shortcut
Ctrl+b then :
new-session -s project2
You're now in the "project2" session.
[project2] 0:bash*
Open the session picker. Use arrow keys to select, Enter to switch.
keyboard shortcut
A session list appears:
(0) playground: 1 windows
(1) project2: 1 windows (attached)
Clean up by killing the project2 session.
keyboard shortcut
Ctrl+b then :
kill-session -t project2
You're automatically switched back to "playground".
đī¸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.
Kill everything from previous exercises. Start completely fresh.
terminal command
All tmux sessions are gone. You're in a plain shell.
$ tmux ls
Create a session for your backend API. Rename the window and simulate a running server.
terminal command
tmux new -s backend
Ctrl+b then ,
watch -n 2 'echo "=== Backend API ===" && echo "Status: RUNNING" && echo "Port: 3000" && echo "Uptime: $(uptime -p)"'
[backend] 0:server*
Screen refreshes every 2 seconds showing:
=== Backend API ===
Status: RUNNING
Port: 3000
Uptime: up 2 hours, 15 minutes
Create a second window in the backend session for watching logs. Now you have 2 windows (tabs) in one session.
keyboard shortcut
Ctrl+b then c
Ctrl+b then ,
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"'
[backend] 0:server 1:logs*
You can switch between them:
đĄ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.
Create a completely separate session for frontend work. This is a new session, not a window â it's isolated from backend.
keyboard shortcut
Ctrl+b then :
new-session -s frontend
Ctrl+b then ,
watch -n 2 'echo "=== Frontend Dev Server ===" && echo "Status: RUNNING" && echo "URL: http://localhost:5173" && echo "HMR: active"'
Create a third session for system monitoring. Build a 4-pane grid â this uses everything you've learned.
keyboard shortcut
Ctrl+b then :
new-session -s monitoring
Ctrl+b then ,
Ctrl+b %
Ctrl+b "
Ctrl+b â
Ctrl+b "
watch -n 5 'df -h | head -5'
Ctrl+b â
top
Ctrl+b â
watch -n 3 free -h
Ctrl+b â
watch -n 5 'echo "=== System ===" && uptime && echo "" && echo "=== Network ===" && ip -brief addr 2>/dev/null || hostname -I'
Your monitoring dashboard:
âââââââââââââââââââââŦâââââââââââââââââââ
â top â watch free -h â
â (CPU/processes) â (memory usage) â
âââââââââââââââââââââŧâââââââââââââââââââ¤
â watch df -h â system/network â
â (disk usage) â info â
âââââââââââââââââââââ´âââââââââââââââââââ
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
Ctrl+b then s
Ctrl+b then w
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)
đĨ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.
Detach from everything. Then check â all 3 sessions should still be running.
keyboard shortcut
$ tmux ls
backend: 2 windows (created ...)
frontend: 1 windows (created ...)
monitoring: 1 windows (created ...)
$ tmux attach -t backend
The ultimate test. Close your terminal window completely (not just detach â actually close it). Then open a brand new terminal and check.
terminal command
tmux ls
tmux attach -t monitoring
All 3 sessions survived the "crash"!
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.