tmux new -s work, start your command, then press Ctrl+b followed by d to detach. The command keeps running on the server after you log out. Reconnect later with tmux attach -t work. GNU screen works the same way with screen -S work, Ctrl+a then d, and screen -r work.
Before you start
- Normally, every program you start in an SSH session stops when the connection drops. tmux and screen are “terminal multiplexers”: they keep a session alive on the server, independent of your connection.
- Use them for long jobs (updates, large copies, compiling, a game server console) and to survive flaky Wi-Fi.
- For services that must run permanently and restart after a reboot, use a systemd service instead.
Should I use tmux or screen?
Use tmux on new servers. It is in the main repositories of every distribution we cover. screen is older and still widespread; on AlmaLinux and Rocky Linux 9 and 10 it is only available from the EPEL repository.How to install tmux
- Ubuntu / Debian
- AlmaLinux / Rocky
tmux -V prints the version if it is.
How to keep a command running with tmux
1
Start a named session
2
Run your command
Start the long job as usual, for example:
3
Detach
Press Ctrl+b, let go, then press d. You return to your normal shell and see
[detached (from session work)]. You can now close SSH.4
Reattach later
Log in again and run:You are back in the session, with the command still running and all its output.
Useful tmux keys
All shortcuts start with the prefix Ctrl+b. Press it, release, then press the next key.How to use screen instead
- Ubuntu / Debian
- AlmaLinux / Rocky
How to check it worked
After detaching, list the sessions:Frequently asked questions
Does tmux survive a server reboot?
No. A reboot ends every tmux and screen session and the programs in them. Use a systemd service for anything that must start on boot.What about nohup or the & sign?
nohup command & keeps a single command running after logout and writes its output to nohup.out, but you can’t get back to it interactively. tmux lets you reattach and type into it.
I get “sessions should be nested with care”. What does it mean?
You rantmux inside an existing tmux session. Detach first, or attach to the session you already have with tmux attach.
Can two people share one tmux session?
Yes, if they log in as the same user: both runtmux attach -t work and see the same screen. This is handy for supporting someone remotely.
Related guides
VPS and dedicated server guides
Every guide in this section.
SSH into a server
Connect before you start tmux.
Create a systemd service
Run programs permanently.
SSH config shortcuts
Keep idle SSH sessions alive.
Essential Linux commands
The basics for new admins.
Checked against the official tmux manual and GNU Screen manual on 4 November 2026; sessions, detach keys and
ls output were tested with tmux 3.4 and screen 4.09 on Ubuntu 24.04 LTS. EPEL package availability checked on Fedora Packages.Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026