tmux's commands are all triggered by a prefix followed by a single key. The default prefix is Ctrl-b; many users rebind it to Ctrl-a (Track 6). For now we'll use the default — every "prefix + X" you read below means: press Ctrl-b, release, press X.
Sessions — your project-level workspaces
One session per project is a good rule of thumb. Sessions have names; you find them by name when you reattach. Inside a session, windows and panes give you the view layout.
Windows — like tabs, but persistent
Windows are the tabbed layer. Each window has its own collection of panes. Most people end up with 3–5 windows per project: "editor," "server," "shell," "logs," "git."
Panes — splits within a window
Panes are where actual shells live. prefix + " splits horizontally (top/bottom); prefix + % splits vertically (left/right). Most people rebind these to prefix + - and prefix + | because the default key choices are unmemorable (Track 6).
The killer pane move: zoom
prefix + z toggles fullscreen on the current pane. When a pane is zoomed it takes up the whole window; when you toggle again it goes back to its place in the layout. Use it for "I need to concentrate on this one for a minute," then unzoom and you're back in the multi-pane view. This is the single most-used tmux command after Ctrl-b itself.
Sessions hold state; windows and panes hold layout. If you reboot, sessions die (unless you save them with tmux-resurrect — Track 6). If you detach, sessions live forever. Most loss-prevention work in tmux is about getting sessions right.
Code
Sessions — from the shell·bash
tmux # new unnamed session (auto-numbered)
tmux new -s myproject # new named session
tmux ls # list all sessions
tmux attach # attach to the most recent
tmux attach -t myproject # attach by name
tmux kill-session -t name # kill one session
tmux kill-server # kill ALL sessions (nuclear option)
Sessions — from inside tmux (prefix = Ctrl-b)·text
prefix + d detach from session
prefix + s list sessions interactively (arrow keys to pick)
prefix + $ rename current session
prefix + ( previous session
prefix + ) next session
Windows·text
prefix + c create new window
prefix + n next window
prefix + p previous window
prefix + 0..9 switch to window by number
prefix + , rename current window
prefix + w list windows interactively
prefix + & kill current window (with confirm)
prefix + l last (most recent) window — toggle
Panes·text
prefix + " split horizontally (top/bottom)
prefix + % split vertically (left/right)
prefix + arrow move between panes
prefix + z ZOOM current pane (toggle fullscreen)
prefix + x kill current pane (with confirm)
prefix + { swap with previous pane
prefix + } swap with next pane
prefix + Space cycle through preset layouts
prefix + q show pane numbers; press a number to jump
prefix + ! break current pane into its own window
prefix + ; toggle to last (most recent) pane
Resizing panes·text
prefix + Ctrl-arrow resize 1 cell at a time
prefix + Alt-arrow resize 5 cells at a time (some terminals)
# Or via command mode:
prefix + :
resize-pane -D 10 down 10
resize-pane -U 5 up 5
resize-pane -L 10 left 10
resize-pane -R 10 right 10
Open a new terminal. Run tmux new -s warmup. Inside tmux: (1) split into two panes side by side with prefix + %; (2) in the right pane, run htop; (3) prefix + z to zoom into htop, prefix + z to come back; (4) create a second window with prefix + c, run top; (5) prefix + 0 back to the first window; (6) detach with prefix + d. Reattach with tmux attach -t warmup — everything should be exactly as you left it.
Progress
Progress is local-only — sign in to sync across devices.