Sessions, Windows and Panes: Learning tmux With Gavos Source

1---
2title: "Sessions, Windows and Panes: Learning tmux With Gavos"
3date: "2026-07-23"
4published: true
5tags: ["gavos", "tmux", "linux", "screen", "terminal", "iterm2", "terminator", "wezterm", "productivity"]
6author: "Gavin Jackson"
7excerpt: "I added sessions, windows and panes to the Gavos console because knowing about tmux is not the same as reaching for it automatically. Here is the short path from GNU Screen muscle memory to a practical tmux workflow."
8---
9
10# Sessions, Windows and Panes: Learning tmux With Gavos
11
12<p align="center"><img src="/assets/gavos-tmux-console.png" alt="The Gavos console running a tmux session with three panes" width="1600"></p>
13
14I have made it a mission to learn tmux properly.
15
16That probably sounds slightly ridiculous because I first wrote [“tmux - where have you been all my life?”](/post/tmux-where-have-you-been-all-my-life) back in 2016, and I revisited the subject in [my terminal multiplexing guide](/post/tmux-terminal-multiplexing) earlier this year. I know what tmux does. I understand why people love it. Yet when I am connected to a Linux box and need a long-running shell, my hands still type `screen`.
17
18GNU Screen is my traditional go-to. It is dependable, familiar and buried deep in my muscle memory. Under pressure, familiarity wins.
19
20So I have tried a different tactic: I have built tmux into **Gavos**, the secret console on gavinj.net. Press the backtick key on a desktop browser, type `tmux`, and Gavos now gives you sessions, windows, panes, the standard `Ctrl-b` prefix and a `man tmux` page. There are clickable tabs too, but the keyboard shortcuts are the point.
21
22The implementation is deliberately a browser-sized teaching version, not a replacement for real tmux. Sessions persist while the page remains open, including when the console is hidden or the session is detached. The aim is to make the core model familiar enough that the real thing stops feeling foreign.
23
24## Emulator or multiplexer?
25
26I think every Linux administrator should know how to use a terminal multiplexer.
27
28That wording matters. iTerm2, Terminator and WezTerm are **terminal emulators**: they provide the window in which a shell runs. tmux and GNU Screen are **terminal multiplexers**: they run inside that terminal, keep multiple shells organised and let you detach a client without ending the session.
29
30For an administrator, that last part is the killer feature. Start an upgrade, a log tail or an incident-response session inside tmux and a dropped SSH connection does not have to destroy your working context. Reconnect, reattach and carry on. The tmux server and its programs still need the host to remain running; ordinary tmux sessions do not magically survive a reboot.
31
32Screen already solves the persistence problem. What attracts me to tmux is the way sessions, windows and panes fit together, the discoverable command interface, and how natural it feels to build a whole working layout inside one connection. It feels like the modern refinement of the workflow I already trust.
33
34## Install tmux
35
36tmux is packaged by the major Linux distributions. The commands below follow the project's [official installation guide](https://github.com/tmux/tmux/wiki/Installing):
37
38```bash
39# Debian or Ubuntu
40sudo apt install tmux
41
42# Fedora
43sudo dnf install tmux
44
45# RHEL or CentOS
46sudo yum install tmux
47
48# Arch Linux
49sudo pacman -S tmux
50
51# openSUSE
52sudo zypper install tmux
53
54# macOS with Homebrew
55brew install tmux
56```
57
58Confirm what you installed with:
59
60```bash
61tmux -V
62```
63
64## The mental model
65
66tmux has three layers:
67
68- A **session** is a persistent workspace. You might have one called `production` and another called `blog`.
69- A **window** is a full terminal screen inside a session. Think of it as a tab.
70- A **pane** is one split region inside a window.
71
72Most shortcuts begin with the default prefix, `Ctrl-b`. Press and release `Ctrl-b`, then press the command key. It is a sequence, not one giant chord. In tmux notation, that prefix appears as `C-b`.
73
74## Your first ten minutes
75
76Create and attach to a named session:
77
78```bash
79tmux new -s learning
80```
81
82Now practise this little circuit:
83
841. Press `Ctrl-b c` to create another window.
852. Press `Ctrl-b %` to split the current pane into left and right panes.
863. Press `Ctrl-b "` to split the current pane into top and bottom panes.
874. Press `Ctrl-b` followed by an arrow key to move between panes.
885. Press `Ctrl-b z` to zoom the active pane, then repeat it to restore the layout.
896. Press `Ctrl-b d` to detach from the session.
90
91Back at the ordinary shell, list the sessions:
92
93```bash
94tmux ls
95```
96
97Then return to the one you created:
98
99```bash
100tmux attach -t learning
101```
102
103That is the essential tmux loop: **create, organise, detach, reattach**. The official [Getting Started guide](https://github.com/tmux/tmux/wiki/Getting-Started) goes deeper, but this is enough to make tmux useful today.
104
105> ## Where iTerm2 Has the Edge
106>
107> iTerm2 on macOS has a genuinely clever [tmux integration](https://iterm2.com/documentation-tmux-integration.html). Run `tmux -CC new -s admin`, or reattach with `tmux -CC attach -t admin`, and iTerm2 uses tmux's control mode to present tmux windows and panes as native iTerm2 tabs and split panes. Creating, closing and resizing them in the GUI sends the corresponding commands to tmux. If SSH drops, tmux keeps the session running; reconnecting and attaching can restore those iTerm2 windows.
108>
109> That is different from merely running tmux inside a split terminal. [tmux control mode](https://github.com/tmux/tmux/wiki/Control-Mode) is a text protocol designed so applications can drive tmux and render its panes in their own interface.
110>
111> I wish Terminator did the same thing. Terminator is still my familiar Linux terminal and it already has very good [native tabs and split panes](https://gnome-terminator.readthedocs.io/en/latest/gettingstarted.html): `Ctrl-Shift-O` splits horizontally and `Ctrl-Shift-E` splits vertically. What I could not find in its current documentation is an iTerm2-style tmux control-mode integration. Terminator's splits and tmux's panes therefore remain two separate layers rather than one shared layout.
112>
113> The closest well-documented Linux equivalent I found is [WezTerm's built-in multiplexing](https://wezterm.org/multiplexing.html). WezTerm can attach local or remote multiplexing domains to its native windows, tabs and panes, giving a very similar user experience on Linux. There is an important catch: it uses the WezTerm multiplexer, not tmux control mode, and a compatible WezTerm installation is required on the remote host for its SSH multiplexing domains. It is an alternative to the workflow, not a drop-in GUI for an existing tmux session.
114
115## Essential tmux cheat sheet
116
117Everything in the second table follows `Ctrl-b`. For example, “`c`” means press and release `Ctrl-b`, then press `c`. These are the default bindings documented in the [tmux manual](https://man.openbsd.org/tmux.1).
118
119### From the shell
120
121| Command | What it does |
122|---|---|
123| `tmux` | Create and attach to a new automatically named session |
124| `tmux new -s NAME` | Create and attach to a named session |
125| `tmux new -d -s NAME` | Create a named session without attaching |
126| `tmux ls` | List sessions |
127| `tmux attach -t NAME` | Attach to a session |
128| `tmux rename-session -t OLD NEW` | Rename a session |
129| `tmux kill-session -t NAME` | Kill a named session |
130
131### Inside tmux
132
133| Prefix key | What it does |
134|---|---|
135| `?` | Show all current key bindings |
136| `d` | Detach from the current session |
137| `s` | Choose a session |
138| `$` | Rename the current session |
139| `c` | Create a window |
140| `n` / `p` | Move to the next / previous window |
141| `0` to `9` | Select a window by number |
142| `w` | Choose a window interactively |
143| `,` | Rename the current window |
144| `&` | Kill the current window after confirmation |
145| `%` | Split into left and right panes |
146| `"` | Split into top and bottom panes |
147| `Arrow` | Move to the pane in that direction |
148| `o` | Move to the next pane |
149| `;` | Return to the previously active pane |
150| `q` | Briefly show pane numbers |
151| `z` | Zoom or restore the current pane |
152| `x` | Kill the current pane after confirmation |
153| `Space` | Cycle through pane layouts |
154| `[` | Enter copy mode to scroll through history |
155| `]` | Paste the most recently copied tmux buffer |
156| `:` | Open the tmux command prompt |
157
158If you remember only six combinations, make them `c`, `%`, `"`, an arrow key, `z` and `d`. You can always use `Ctrl-b ?` when your memory fails.
159
160## Building the habit
161
162My plan is intentionally boring:
163
164- Start a named tmux session whenever I SSH into a machine to do real work.
165- Use windows for separate jobs and panes when I need to see two jobs at once.
166- Detach before disconnecting, even when I do not strictly need to.
167- Keep the default `Ctrl-b` prefix until the standard shortcuts become automatic.
168- Practise in Gavos when I catch myself reaching for Screen.
169
170I am not deleting `screen` or pretending it suddenly became a bad tool. This is about replacing a reflex, and reflexes only change through repetition. I can already see why tmux is better for the way I want to work. Now I need my fingers to catch up.
171
172Press the backtick key anywhere on gavinj.net, type `tmux`, and have a play. If you get lost, `Ctrl-b ?` and `man tmux` are there to bring you home.
173
174---
175
176**Further reading:**
177
178- [tmux: where have you been all my life?](/post/tmux-where-have-you-been-all-my-life)
179- [From Screen to Supreme: The Evolution of Terminal Multiplexing](/post/tmux-terminal-multiplexing)
180- [Official tmux Getting Started guide](https://github.com/tmux/tmux/wiki/Getting-Started)
181- [Official tmux manual](https://man.openbsd.org/tmux.1)
182