Frequently Asked Question

What is tmux and why do sysadmins always use it on remote servers?

tmux (and its predecessor screen) is a terminal multiplexer: it runs as a long-lived daemon and hosts shells inside virtual terminals that you connect to, rather than running shells directly inside your real terminal. The big consequence is that the network can disappear, your laptop sleeps, your Wi-Fi drops, your SSH tunnel breaks, and the shells inside tmux keep running. You reconnect with tmux attach and find every session, every window, and every running command exactly where you left it.

The secondary benefit is splitting the terminal: Ctrl-B % for a vertical pane, Ctrl-B " for horizontal, Ctrl-B c for a new window. You can have a server's logs tailing in one pane, an editor in another, and a shell in a third, all in a single SSH connection. Anyone doing serious remote work eventually adopts the habit "first thing on the server is tmux new -s work", and never again loses hours of progress to a flaky connection.

Further reading and video