Skip to content
shellmap

tmuxTerminal multiplexer — persistent sessions and split panes across all 5 shells

Equivalents in every shell

Bashunix
tmux new -s work

Start a named session you can detach from (`Ctrl-b d`) and reattach later (`tmux attach -t work`). Survives SSH disconnects — kill your laptop, reconnect, `tmux attach`, and your work is still there. Core key chord: prefix `Ctrl-b` then a letter — `%` split vertical, `"` split horizontal, `arrow` move pane, `c` new window, `n`/`p` next / prev window, `d` detach, `?` keybindings list. Config in `~/.tmux.conf`. The sibling tool `screen` exists but is largely superseded.

Zshunix
tmux new -s work

Same external binary on macOS / Linux. macOS via `brew install tmux`; Linux via the distro's package manager. macOS-specific gotcha: in earlier tmux versions, copy-paste integration with the system pasteboard required `reattach-to-user-namespace` — modern tmux (≥ 3.2) supports `pbcopy` / `pbpaste` directly. For "tmux on macOS terminal", iTerm2 + tmux works smoothly; Terminal.app works but has fewer key-binding hooks.

Fishunix
tmux new -s work

Same external. Fish-friendly config tip: set `default-shell /usr/bin/fish` in `~/.tmux.conf` so new tmux windows start fish by default (otherwise tmux uses `$SHELL` from the env that launched it). Common confusion: `tmux ls` lists SESSIONS; the windows within each session need a tmux command inside the session (prefix + `w` for the window menu) — sessions are a layer above what most users think of as "terminal tabs".

PowerShellwindows
Start-Job -Name work -ScriptBlock { ... }

No native PowerShell tmux equivalent — `Start-Job` / `Receive-Job` cover the BACKGROUND-WORK use case (a job runs while you keep typing in the foreground) but NOT the SESSION-PERSISTENCE or PANE-SPLITTING use cases. Windows Terminal's pane feature (`Alt+Shift+D` to split, `Alt+arrow` to move) gives you the split-pane half — but panes die when the Windows Terminal window closes (no detach / reattach). For real tmux-on-Windows: install WSL2, then `tmux` from inside WSL. There is no first-party Windows multiplexer.

cmd.exewindows
wsl tmux new -s work

No cmd.exe-native multiplexer. Closest options: (1) WSL + `tmux` from inside WSL (the standard answer); (2) ConEmu / Cmder — third-party terminal emulators with tab + pane features but no detach / reattach; (3) Windows Terminal Preview's "pane" feature (no session persistence). The Microsoft strategy for "I want tmux on Windows" is "install WSL and use tmux there". The actual `tmux` binary does NOT exist for native Windows.

Worked examples

Start a named session and detach

Bash
tmux new -s work    # then Ctrl-b d to detach
Fish
tmux new -s work
PowerShell
wsl tmux new -s work
cmd.exe
wsl tmux new -s work

List sessions, reattach to one

Bash
tmux ls && tmux attach -t work
Fish
tmux ls; and tmux attach -t work
PowerShell
wsl tmux ls; wsl tmux attach -t work
cmd.exe
wsl tmux ls && wsl tmux attach -t work

Split current pane horizontally + vertically (inside tmux)

Bash
Ctrl-b %   # vertical split (left/right)
Ctrl-b "   # horizontal split (top/bottom)
PowerShell
# Windows Terminal native split:
# Alt+Shift+D split, Alt+arrow move

Gotchas

  • `tmux ls` outside a session lists existing sessions. `tmux ls` INSIDE a session SOMETIMES works (depending on socket reachability) but the canonical "list windows in this session" is the prefix + `w` menu. Confusing the two layers (sessions vs windows vs panes) is the #1 newbie source of "where did my work go" — your work is in a window inside a session, both addressable, both listable, both keyboard-bound.
  • tmux sessions are tied to the SOCKET, typically `/tmp/tmux-<UID>/default`. If `/tmp` is cleaned (some distros wipe it on reboot; container restarts always do), every session dies even though tmux itself is "designed to survive disconnects". To make sessions truly machine-reboot-survivable you need a separate process supervisor (systemd unit) — tmux is RECONNECT-survivable, not REBOOT-survivable.
  • tmux key prefix default `Ctrl-b` clashes with readline `Ctrl-b` (back one char). Most users remap to `Ctrl-a` via `~/.tmux.conf`: `set -g prefix C-a; unbind C-b; bind C-a send-prefix`. But `Ctrl-a` clashes with bash readline beginning-of-line. There is no prefix that doesn't step on something — pick the conflict you tolerate. (Fish has different readline bindings, so on fish + tmux the `Ctrl-a` remap is less painful.)
  • On macOS, scroll-back in tmux uses tmux's OWN scroll buffer (`Ctrl-b [` then PgUp), NOT the terminal emulator's buffer. Without the prefix you cannot scroll up in tmux — your terminal's scroll wheel does nothing useful. Two fixes: enable "mouse mode" in tmux 2.1+ (`set -g mouse on` in `~/.tmux.conf`), or use iTerm2's tmux-integration mode (`tmux -CC`) which delegates scroll-back to iTerm2 itself.
  • PowerShell `Start-Job` is NOT a tmux equivalent — it spawns a background WORKER process, not a detached SESSION. The job runs script, captures output, and you `Receive-Job` to drain results — there's no interactive terminal you can later "reattach" to and keep typing in. Conflating the two leads to scripts that try to use `Start-Job` for what they actually need WSL+tmux for.

WSL & PowerShell Core notes

pwshNo tmux equivalent in pwsh on any OS. On Linux/macOS pwsh, shell out: `& tmux new -s work`. On Windows pwsh, no native multiplexer exists — the Microsoft answer is WSL + tmux, called from pwsh as `wsl tmux ...`. The community module `PSReadLine` covers READLINE behaviour (history, completion) but is not a session manager. For Windows-pwsh "detached background process" needs that don't require reattach, `Start-Process -WindowStyle Hidden` is the right tool — but again, not tmux.
WSLtmux installs in WSL via the distro's package manager (`apt install tmux` / `dnf install tmux`). It's the standard "tmux on Windows" answer. One quirk: on Windows Terminal hosting a WSL bash inside tmux, the title-bar tab title is set by Windows Terminal, not by tmux's `set-titles` — you need both layers cooperating for the title you see to reflect the active tmux pane. WSL2's per-distro `init` does NOT run systemd by default unless opted in, so launching tmux automatically at WSL startup (via `~/.bashrc` or a systemd unit) needs a few config bits.

Related commands