Side by side
| Task | tmux | screen |
|---|---|---|
| Prefix key | Ctrl+b | Ctrl+a |
| New named session | tmux new -s work | screen -S work |
| Detach | Ctrl+b d | Ctrl+a d |
| List sessions | tmux ls | screen -ls |
| Attach | tmux attach -t work | screen -r work |
| Start in the background | tmux new -d -s work | screen -dmS work |
| New window | Ctrl+b c | Ctrl+a c |
| Split top and bottom | Ctrl+b " | Ctrl+a S |
| Split side by side | Ctrl+b % | Ctrl+a | |
| Next region or pane | Ctrl+b o | Ctrl+a Tab |
| Send keys from a script | tmux send-keys -t work 'ls' Enter | screen -S work -X stuff 'ls\n' |
| Status bar by default | Yes | No |
| Serial ports | No | Yes, for example screen /dev/ttyUSB0 115200 |
| License | ISC and BSD style | GPL |
Differences that matter in practice
Panes
A tmux pane is a shell from the moment you split. A new screen region is empty, and you have to move to it and press Ctrl+a c.
The prefix key
In a shell, Ctrl+a normally jumps to the start of the line. Under screen you press Ctrl+a a for that. tmux uses Ctrl+b, which is less often used.
Scripting
Both can be driven from outside, as the table shows. tmux has more to work with, such as tmux capture-pane -p to read the screen and tmux has-session to test for a session.
Availability
Neither is sure to be on a minimal server, but you can install either from standard package repositories on Debian and Ubuntu:
sudo apt install tmux
sudo apt install screen
Debian 13 packages tmux 3.5a and screen 4.9.1. macOS still ships screen 4.00.03 from 2006, and no tmux. For the current tmux on a Mac, use Homebrew: brew install tmux.
When a session cannot be attached
A session that is still attached somewhere else will not open with a plain screen -r, which prints There is no screen to be resumed matching work. Use screen -d -r work to detach it from the other place first. In tmux, tmux attach -d -t work does the same thing.
For the full list of tmux commands, see the tmux cheat sheet.
Why a session survives a dropped connection is explained in keep SSH sessions alive with tmux.
Questions
Is tmux better than screen?
For keeping programs running after you disconnect, both work. tmux is easier to start with, thanks to its status bar, ready panes and scriptable commands. screen is the one to use for serial ports or when it is the only tool on the server.
Which one is installed by default?
Neither is sure to be on a minimal server. On Debian and Ubuntu, install either with sudo apt install tmux or sudo apt install screen.
Can a tmux session be attached from two places at once?
Yes. tmux attach -t work joins a session that is already attached elsewhere, and tmux attach -d -t work detaches the other place first.