CloudLinux.ro
Dev environments

How to keep sessions running after disconnect with tmux

Updated 7/20/2026

If you close the SSH connection, processes started in the terminal stop. tmux solves this: sessions stay alive on the server and you can reconnect to them anytime.

1. Install

apt-get update -y
apt-get install -y tmux

2. Start a session

tmux new -s work

3. Detach (the session stays running)

Press Ctrl+b then d. You can close SSH; the process continues.

4. Reconnect

tmux attach -t work
tmux ls              # list sessions

When it is useful

  • Long migrations or backups that must not be interrupted.
  • Builds or database imports that take hours.
  • Watching a live process without having to keep SSH open.

tmux or systemd?

tmux is for temporary, interactive tasks. For permanent services that must start on their own, use a systemd service.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials