If you've lost a long-running task because your SSH connection dropped, you already know the pain tmux solves. It is a terminal multiplexer: one terminal that can hold many terminals. It was created in 2007 by Nicholas Marriott as a clean, BSD-licensed alternative to the older GNU Screen, and it is free and open-source software. You can install it on Linux, macOS, OpenBSD, FreeBSD, and NetBSD. The current release series is 3.x.
What a multiplexer actually gives you
Three things make tmux worth learning:
- Persistent sessions. Start something, close your laptop, and your work keeps running. When you reconnect, your session — exactly as you left it — is still there. This matters most on remote servers, where an SSH disconnection would otherwise kill everything.
- Splits. Divide one screen into panes. Edit code on one side while a test runs on the other.
- Multiple windows. Each window is a full work area, like a browser tab for your terminal.
Together they turn a single login into a workspace you can reattach to from anywhere.
Start a session
Install tmux with your system's package manager (apt, brew, dnf), then create a named session:
tmux new -s app
The -s gives your session a name, which makes it easy to find later. Your prompt looks the same, but you are now inside tmux.
The prefix key
Most tmux commands start with a prefix: Ctrl-b. Press Ctrl-b, release it, then press the command key. Think of it as "hey tmux, listen up." These are the moves you'll use every day:
Ctrl-b c— create a new windowCtrl-b n/Ctrl-b p— go to the next / previous windowCtrl-b %— split the window vertically (panes side by side)Ctrl-b "— split the window horizontally (one pane above the other)Ctrl-b d— detach from the session
Detach and reattach
Detaching is the magic trick. Press Ctrl-b d to detach. Your shell prompt returns, but the session keeps running in the background. You can walk away, come back hours later, even on a different machine, and resume:
tmux attach -t app
That single behavior — a shell that survives a dropped connection — is why tmux is standard issue on remote servers.
Keep an eye on what's running
Running several sessions and lost track? List them all:
tmux ls
Each row shows a session name, how many windows it holds, and when it was created.
Start small
You don't need every shortcut on day one. Master the prefix, one split, one detach-and-reattach, and the habit of starting long work inside tmux. That is enough to change how you work in the terminal. Once those feel natural, dig into panes, custom keybindings, and your ~/.tmux.conf to make the multiplexer truly yours.