Guide

tmux on a VPS

Last updated: 15 November 2026

If your SSH connection drops, programs started in that session stop with it. tmux keeps your terminal alive on the server: you start a session, leave it running and come back later from anywhere. It is ideal for long downloads, builds, imports and anything you want to watch. If you are logged in as root, leave out sudo.

Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works

Install

sudo apt install -y tmux        # Debian, Ubuntu
sudo dnf install -y tmux        # AlmaLinux, Rocky

The basics

tmux new -s work       # start a session named work
# run your command, then press Ctrl+b and then d to detach
tmux ls                # list sessions
tmux attach -t work    # come back to it
tmux kill-session -t work   # end the session and everything running in it

When you detach, everything keeps running. After a dropped connection, log in again and run tmux attach -t work.

Keys worth knowing

All keys start with Ctrl+b, then:

Good to know

More basics: first login · checking resources · Fast VPS

Questions and answers

Why does my command stop when SSH disconnects?
Programs started in the SSH session end with it. Run them inside tmux (or as a service) so they keep running.

How do I leave tmux without stopping my command?
Press Ctrl+b and then d to detach; the session and your command keep running.

How do I get back to my session?
Log in again and run tmux attach -t NAME; tmux ls lists the sessions.

Does tmux survive a reboot?
No. For something that must always run, make it a systemd service.

Ready to try it? Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works