tmux Cheat Sheet: Sessions, Windows and Panes
A tmux cheat sheet for the keys and commands you'll actually use: sessions that survive a dropped SSH connection, windows, split panes, scrolling and config.

On this page 7 sections ▾
TL;DR
- Every tmux shortcut starts with the prefix,
Ctrl+b: press it, let go, then press the key. - Detach with
Ctrl+b dand everything in the session keeps running.tmux attachputs you right back where you left off. Ctrl+b %splits side by side andCtrl+b "splits top and bottom. Those two are worth memorizing first.
Close your laptop in the middle of an SSH session, lose your Wi-Fi, or let the connection time out, and anything you were running on the server usually dies with it. This tmux cheat sheet is the fix: sessions that keep running without you, plus one terminal split into as many panes as your screen can fit. Every key and command below was checked against tmux 3.4 with its default settings.
Quick facts
Any number of terminals can attach to the same session at once. Attach from your laptop and your desktop, and both show the same screen as you type.
Ctrl+b ? lists tmux's key bindings with a short note on each, so the cheat sheet is built in if you forget one.
Ctrl+b t turns the pane into a big digital clock. Any key brings your terminal back.
Copy mode uses emacs-style keys by default, unless your EDITOR or VISUAL setting contains "vi", in which case tmux switches to vi-style keys on its own.
#Sessions, windows and panes
ELI5: explain it simply▾

THE WORDS
- Session
- Your whole tmux workspace. It keeps running even when you close the terminal you started it from.
- Window
- A full-screen tab inside a session. The bar at the bottom lists them.
- Pane
- One piece of a window after you split it, each with its own shell.
THE IDEA
Think of a session as a desk you can walk away from and come back to with everything still on it. Windows are the folders on the desk, and panes are the pages you've laid out side by side inside one folder.
Keys work in two steps. Press Ctrl+b, the prefix, let go of both keys, then press the shortcut key. So Ctrl+b d means: hold Ctrl and tap b, release, then tap d.
#Sessions
- tmux new -s workStarts a new session named work and opens it.
- tmux lsLists your sessions, even from outside tmux.
- tmux attach -t workReattaches to the work session. Plain
tmux attachpicks the most recently used session, preferring one nobody else is attached to. - Ctrl+b dDetaches. You leave tmux, but the session and everything in it keep running.
- Ctrl+b sOpens a list of sessions to switch between with the arrow keys and Enter.
- Ctrl+b $Renames the current session.
- tmux kill-session -t workEnds the work session and closes everything running in it.
student@opnf:~$ tmux new -d -s work student@opnf:~$ tmux new -d -s logs # -d starts a session in the background without opening it student@opnf:~$ tmux ls logs: 1 windows (created Sat Nov 7 23:31:34 2026) work: 1 windows (created Sat Nov 7 23:31:34 2026) student@opnf:~$ tmux rename-session -t logs monitor student@opnf:~$ tmux ls monitor: 1 windows (created Sat Nov 7 23:31:34 2026) work: 1 windows (created Sat Nov 7 23:31:34 2026) student@opnf:~$ tmux kill-session -t monitor student@opnf:~$ tmux ls work: 1 windows (created Sat Nov 7 23:31:34 2026)
#Windows
- Ctrl+b cCreates a new window.
- Ctrl+b ,Renames the current window, so the bottom bar shows something more useful than bash.
- Ctrl+b nGoes to the next window.
- Ctrl+b pGoes to the previous window.
- Ctrl+b 0 to 9Jumps straight to a window by its number.
- Ctrl+b wShows every window in every session as a list you can pick from.
- Ctrl+b &Closes the current window, after asking you to confirm.
Get opnF in your inbox
Tech news for IT professionals that actually teaches you something.
Our promise to you: we'll be conscious about email quality/frequency, and your address will never be shared/sold.
#Panes
- Ctrl+b %Splits the current pane into two side by side.
- Ctrl+b "Splits the current pane into two, one above the other.
- Ctrl+b arrow keyMoves to the pane in that direction.
- Ctrl+b oMoves to the next pane in turn.
- Ctrl+b zZooms the current pane to fill the window. Press it again to put it back.
- Ctrl+b Ctrl+arrowResizes the pane a little in that direction. Use Alt+arrow instead of Ctrl+arrow to resize in bigger steps.
- Ctrl+b SpaceCycles through tmux's built-in pane layouts.
- Ctrl+b xCloses the current pane, after asking you to confirm. Typing
exitin it works too.
Tip
tmux's own menu calls % a horizontal split and " a vertical one, which trips a lot of people up. Go by the result instead: % gives you panes side by side, " stacks them.
Every key above is also a command you can type, which is how scripts build a layout without touching the keyboard.
student@opnf:~$ tmux split-window -h -t work student@opnf:~$ tmux new-window -t work -n build student@opnf:~$ tmux list-windows -t work 0: bash- (2 panes) [80x24] [layout 0206,80x24,0,0{40x24,0,0,0,39x24,41,0,2}] @0 1: build* (1 panes) [80x24] [layout b260,80x24,0,0,3] @2 (active)
#Scrolling and copying
tmux leaves the mouse off by default, so it doesn't handle the scroll wheel. Scrolling back through output happens in copy mode instead, or with the mouse turned on in the config below.
- Ctrl+b [Enters copy mode, where the arrow keys and Page Up and Page Down scroll back through the pane's history.
- Ctrl+b Page UpEnters copy mode and scrolls up a page in one move.
- Ctrl+rIn copy mode with the default keys, searches back up through the output.
Ctrl+ssearches down. - Ctrl+Space, then Alt+wIn copy mode with the default keys, starts a selection where the cursor is, then copies it once you've moved to the end.
- qLeaves copy mode and puts the pane back to normal.
- Ctrl+b ]Pastes the last text you copied in tmux.
For your information
If your editor is set to vim, copy mode uses vi-style keys instead: / searches, Space starts a selection and Enter copies it. Arrow keys, Page Up and q work the same either way.
#A starter tmux config
tmux reads its settings from ~/.tmux.conf when it starts. These are the most common first edits: a prefix that's easier to reach, the mouse turned on, and windows and panes numbered from 1 so the numbers line up with your keyboard. With Ctrl+a as the prefix, press it twice when a program needs a real Ctrl+a, like jumping to the start of a line in bash.
| 1 | # Use Ctrl+a as the prefix instead of Ctrl+b |
| 2 | unbind C-b |
| 3 | set -g prefix C-a |
| 4 | bind C-a send-prefix |
| 5 | |
| 6 | # Turn on the mouse: click panes, drag borders, scroll |
| 7 | set -g mouse on |
| 8 | |
| 9 | # Number windows and panes from 1 instead of 0 |
| 10 | set -g base-index 1 |
| 11 | setw -g pane-base-index 1 |
student@opnf:~$ tmux source-file ~/.tmux.conf student@opnf:~$ tmux show -g prefix prefix C-a student@opnf:~$ tmux show -g mouse mouse on
#Going past the tmux cheat sheet
tmux pays off most on a remote server, where a session can keep a backup, a build or a log watch running while you log off. Start one before your next long job and leave it there; you'll reach for the keys on this page without looking soon enough.

Get comfortable in the terminal
Linux Fundamentals, Level 1 of DevOps Pro, is where you actually work through the command line step by step, with labs and quizzes in a simulated terminal. Level 1 is free.
How do I scroll up in tmux?
Ctrl+b [ to enter copy mode, scroll with the arrow keys or Page Up, then press q to leave. Or add set -g mouse on to your config and use the mouse wheel.How do I exit tmux?
Ctrl+b d. To end it, type exit in every pane, or run tmux kill-session -t name. tmux kill-server ends every session at once.How do I reattach to a tmux session?
tmux ls to see the names, then tmux attach -t name. If there's only one session, tmux attach is enough.Why isn't my tmux config working?
tmux source-file ~/.tmux.conf to load them.Sourcestmux(1) manual
Get opnF in your inbox
Tech news for IT professionals that actually teaches you something.
Our promise to you: we'll be conscious about email quality/frequency, and your address will never be shared/sold.