Sessions, Windows and Panes: Learning tmux With Gavos Source
Markdown source
1---2title: "Sessions, Windows and Panes: Learning tmux With Gavos"3date: "2026-07-23"4published: true5tags: ["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---910# Sessions, Windows and Panes: Learning tmux With Gavos1112<p align="center"><img src="/assets/gavos-tmux-console.png" alt="The Gavos console running a tmux session with three panes" width="1600"></p>1314I have made it a mission to learn tmux properly.1516That 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`.1718GNU Screen is my traditional go-to. It is dependable, familiar and buried deep in my muscle memory. Under pressure, familiarity wins.1920So 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.2122The 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.2324## Emulator or multiplexer?2526I think every Linux administrator should know how to use a terminal multiplexer.2728That 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.2930For 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.3132Screen 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.3334## Install tmux3536tmux is packaged by the major Linux distributions. The commands below follow the project's [official installation guide](https://github.com/tmux/tmux/wiki/Installing):3738```bash39# Debian or Ubuntu40sudo apt install tmux4142# Fedora43sudo dnf install tmux4445# RHEL or CentOS46sudo yum install tmux4748# Arch Linux49sudo pacman -S tmux5051# openSUSE52sudo zypper install tmux5354# macOS with Homebrew55brew install tmux56```5758Confirm what you installed with:5960```bash61tmux -V62```6364## The mental model6566tmux has three layers:6768- 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.7172Most 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`.7374## Your first ten minutes7576Create and attach to a named session:7778```bash79tmux new -s learning80```8182Now practise this little circuit:83841. 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.9091Back at the ordinary shell, list the sessions:9293```bash94tmux ls95```9697Then return to the one you created:9899```bash100tmux attach -t learning101```102103That 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.104105> ## Where iTerm2 Has the Edge106>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.114115## Essential tmux cheat sheet116117Everything 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).118119### From the shell120121| 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 |130131### Inside tmux132133| 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 |157158If you remember only six combinations, make them `c`, `%`, `"`, an arrow key, `z` and `d`. You can always use `Ctrl-b ?` when your memory fails.159160## Building the habit161162My plan is intentionally boring:163164- 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.169170I 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.171172Press 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.173174---175176**Further reading:**177178- [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