Skip to content

tmux

Keeps shells alive independently of the terminal window attached to them.

Homebrew formula Direct download

What it does

tmux runs a server holding sessions; a terminal attaches to one and can detach without killing anything inside. Each session holds windows, each window splits into panes.

The practical payoff for a homelab: SSH into a box, start a long job inside tmux, lose the connection, reattach and it is still running.

tmux new -s lab        # start a named session
tmux ls                # list sessions
tmux attach -t lab     # reattach
# C-b d detach · C-b % split vertical · C-b " split horizontal

Notes

Pairs with pam-reattach on macOS — without it, Touch ID for sudo and clipboard access misbehave inside a tmux pane.

Alternative to

AlternativeTypeTrade-off
ZellijOpen sourceFriendlier defaults, discoverable keybindings, panes and layouts out of the box
GNU ScreenOpen sourceOlder, simpler, usually already installed on a server
iTerm2 or WezTerm panesOpen sourceNative splits, but they do not survive a lost connection
nohup or systemd-runBuilt inIf surviving disconnection is all you need

Install

brew install tmux

Links

This post is licensed under CC BY 4.0 by the author.
Last updated on