What Are tmux Windows and How Do You Use Them?
Updated
tmux windows are full-screen terminal workspaces inside a single tmux session. Each window holds its own shell or program, and you switch between them with a prefix key plus a number or letter. They let you keep, say, an editor in window 1, a test runner in window 2, and logs in window 3 without opening new terminal tabs. On Windows, the same model works through a native multiplexer such as psmux, which the source describes as a Rust-built terminal multiplexer with full tmux compatibility and no WSL.
Sessions, windows, and panes: what nests inside what
tmux has three levels, and mixing them up is the most common source of confusion:
| Level | What it is | Typical use |
|---|---|---|
| Session | A collection of windows managed by one tmux server | One project or one server connection |
| Window | A full-screen workspace inside a session, containing one or more panes | One task: editor, shell, logs |
| Pane | A split region inside a window | Side-by-side views of the same task |
A session can hold many windows; a window can hold many panes. Detaching from a session leaves everything running in the background, and reattaching brings the whole set back.
Default key bindings for window management
tmux commands are issued after pressing the prefix, Ctrl-b by default. Press the prefix, release it, then press the command key.
Create a window
Ctrl-b ccreates a new window and switches to it. New windows are numbered in order and named after the running program.
Switch windows
Ctrl-b nmoves to the next window;Ctrl-b pmoves to the previous one.Ctrl-b 0throughCtrl-b 9jump directly to a window by number.Ctrl-b ltoggles back to the last window you used, which is handy when bouncing between two.
Rename a window
Ctrl-b ,prompts for a new name. Renaming matters once you have several windows, because the default name follows whatever program started in the window and can become misleading.
Close a window
- Type
exitin the window's shell, or pressCtrl-b &and confirm. Closing the last window in a session ends the session.
List windows
Ctrl-b wopens an interactive window list you can navigate and select from. The status bar at the bottom also shows all windows in the current session, with the active one marked.
A concrete example
Suppose you are working on a web service. You start tmux, then:
Ctrl-b c— window 1 runs your shell.Ctrl-b cagain, then start the dev server — window 2.Ctrl-b ca third time, then run the test watcher — window 3.Ctrl-b ,in each window to name themshell,server, andtests.Ctrl-b 1,Ctrl-b 2,Ctrl-b 3to jump between them;Ctrl-b lto flip back and forth.
Detach with Ctrl-b d, and the server and tests keep running. Reattach later and all three windows are as you left them.
Running tmux windows on Windows
Native tmux does not run on Windows without a compatibility layer. psmux is presented as a native alternative built in Rust that works with Windows Terminal, PowerShell, and cmd.exe, with full tmux compatibility and no WSL. That means the session/window/pane model and the key bindings above are the ones to learn; check the project's own documentation for any binding differences before relying on them.
Common pitfalls
- Prefix confusion. Pressing
Ctrl-band the command key simultaneously often does nothing. Press and release the prefix first, then the command. - Detached sessions look like lost work. After
Ctrl-b dthe terminal returns to the normal prompt. The windows are still running; reattach to the session to get them back. - Closing the last window. Exiting the only window in a session ends that session, so keep at least one window alive if you want the session to persist.
- Numbering gaps. Closing a window leaves its number unused; new windows take the next free number rather than renumbering. Use names or the window list (
Ctrl-b w) when numbers stop matching your mental map. - Program-based names. A window named after a program that has since exited can mislead you; rename windows for the task instead.