How to keep sessions running after disconnect with tmux
Updated 10/16/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 pricingRelated tutorials
How to send WhatsApp messages from your apps with OpenWA
OpenWA gives you a REST API over WhatsApp, on your own server. Here is how to install it, connect it and send your first message, safely.
Updated 10/16/2026Dev environmentsHow to deploy an app from Git with Openship
From a Git repo to a live app, with a database, domain and SSL, on your own server, with no config files.
Updated 10/16/2026Dev environmentsHow to install PHP (multiple versions) and Composer
Install the PHP version your project needs, along with Composer for package management.
Updated 10/16/2026