For getting comfortable at the terminal

3 chapters · 8 lessonsAbout 1 h

tmux Introduction

Beginner

A free, hands-on course on how to use tmux, the terminal multiplexer. Start it, split panes and windows, name sessions, detach and reattach, search and copy from the scrollback, and finally run a long build over SSH that survives a dropped connection. All in your browser, matched to tmux 3.7.

This course continues from Terminal Introduction

About this course

tmux is a terminal multiplexer: several shells in one terminal, and sessions that survive a lost connection. Shells run inside the tmux server, so the session is still there after the client closes or SSH drops.

This course covers the questions in the order people hit them in their first week with tmux: starting and detaching, the prefix key, how sessions, windows, and panes differ, why you cannot scroll, and the config file. Finally you experience the reason tmux exists: a long job on a server survives a dropped connection.

The tmux in the exercises is a simulation running in your browser, matched to the default key bindings and screens of tmux 3.7. Every exercise is graded on the state you reach, not on which keys you pressed, so any route to the same state is correct.

Sample Lessons

Skills you'll learn

Start, Detach, Reattach

Understand sessions, windows, and panes, why a job keeps running after you detach, and how to reattach to it.

Shape the Screen Freely

Split, move, zoom, and resize panes, and create and name windows without hesitating after the prefix key.

Configure Your Own tmux

Write a three-line `.tmux.conf` that works as is, and search and copy from the scrollback in copy mode.

A page of the tmux cheat sheet

tmux Cheat Sheet

Every key and command from this course on one A4 page. The PDF is free and prints as is.

Who this course is for

Your Job on the Server Ends When the Connection Drops

The final practice runs a long job inside tmux, drops the connection, and reattaches to find it still running.

Want to See Two Things at Once

Tail the server log in one pane while you work in another. Learn to split panes and move the focus between them.

Know the Name, Never Started Using It

The first lesson covers starting, detaching, and reattaching, so you can use it every day from there.

Syllabus

3 chapters · 8 lessons

Keys and commands

Start and detach

Practice →
Terminal$[0] 0:bash*tmux serversession 0./build.shrunningCtrl+b dtmux attachShells run inside the server, so closing the terminal loses nothing
tmux
Start tmux
Ctrl+b
The prefix key. Press and release it, then the next key
Ctrl+bd
Detach (the session stays)
tmux ls
List sessions
tmux attach
Reattach
Ctrl+b?
List key bindings (q closes it)
Ctrl+b:
Enter a command
$$[0] 0:bash*Ctrl+b %Split left and right$$[0] 0:bash*Ctrl+b "Split top and bottom$[0] 0:bash*ZCtrl+b zZoom
Ctrl+b%
Split left and right
Ctrl+b"
Split top and bottom
Ctrl+b←↑↓→
Move the focus
Ctrl+bz
Zoom (again to restore)
Ctrl+bCtrl+←↑↓→
Move the border one cell
resize-pane -L 5
Resize with a command (use this on a Mac)
Ctrl+bx
Close the pane
[api]0:server1:logs*2:shellppreviousnnext3:bashccreateA window is a tab. * marks the current one
Ctrl+bc
Create a window
Ctrl+b,
Rename it
Ctrl+bn/p
Next / previous
Ctrl+bl
The last window
Ctrl+b0-9
Select by number
Ctrl+bw
Choose from a list
Ctrl+b&
Kill the window

Sessions

Practice →
session apiwindow 0:serverpanepaneCtrl+b sswitchessession web
tmux new -s api
Create a named session
tmux attach -t api
Reattach by name
Ctrl+bs
Switch sessions
Ctrl+b$
Rename the session
tmux kill-session -t api
Kill one session
tmux kill-server
Kill everything

.tmux.conf

Practice →
A ~/.tmux.conf you can use as is
# Scroll and select with the mouse
set -g mouse on
# vi keys in copy mode
set -g mode-keys vi
# Reload with Ctrl+b r
bind r source-file ~/.tmux.conf
Ctrl+br
Reload (once bind r is in the file)
source-file ~/.tmux.conf
Reload (type it after Ctrl+b :)

Copy mode (vi)

Practice →
[21/120]position in history?search upSpace→Enterselect and copy
Ctrl+b[
Enter copy mode
↑↓PgUp
Scroll
?//
Search up / down
n/N
Next match / reverse
Space→Enter
Select and copy
Ctrl+b]
Paste
q
Exit copy mode
// READY?

BEGIN YOUR
JOURNEY

Join thousands of developers who've mastered the terminal. Your first lesson awaits.

Get Started →