List of Articles Icon

Knowledge Base

Guides and answers for your VPS, the client area, and billing

How can I keep an application running after I disconnect from SSH?

What this is

You start something over SSH, a long build, a download, a game server, and when the connection drops (or you close the laptop), it dies. That's by design: processes you start belong to your login session, and the session's end sends them a hangup. Three tools fix it; pick by what the thing is.

tmux: for interactive work you'll return to

The right default for humans. tmux gives you a terminal session that lives on the server, detached from your SSH connection:

apt install tmux
tmux            # start a session, run your stuff inside it

Detach with Ctrl+B then D (or just let SSH drop, same effect), reconnect any time from anywhere:

tmux attach

and your program is exactly where you left it, output history included. Multiple sessions: tmux new -s build, tmux ls, tmux attach -t build. This is why every long-running command in this knowledge base (migrations, big transfers) says "run it in tmux". (screen is the older equivalent, fine if it's what your hands know.)

systemd: for anything that should always run

If the answer to "should this still be running next month?" is yes, a game server, an app, a bot, it isn't a terminal job at all, it's a service: a ten-line unit file gets it starting at boot, restarting on crash, and logging to the journal, the same recipe as the timers guide, and the difference between a program that survives your disconnect and one that survives a reboot. An AI chatbot drafts the unit from "write a systemd service for as ".

nohup: the quick fire-and-forget

For a one-shot command you just want to outlive the session, no reconnecting needed:

nohup ./long-job.sh > job.log 2>&1 &

It ignores the hangup, runs in the background, and writes output to the log you pointed it at. No way to reattach, that's tmux's job, but nothing to install.

"I already started it without any of these"

A running job in your current session can still be saved: Ctrl+Z to suspend it, bg to resume it in the background, then disown -h %1 detaches it from the session's hangup. Cruder than starting in tmux, but it rescues the three-hour job you forgot to protect. (The fg/bg/jobs machinery has its own section in the process guide.)

Still need help?

You can open a support ticket. So we can help on the first reply, it's worth mentioning:

  • the VPS hostname or IP,
  • the program you're keeping alive, and the approach you tried (tmux, systemd, nohup).
  • "Why does my program stop when I close SSH?"
  • "How do I use tmux to keep something running?"
  • "Should I use tmux, nohup, or a systemd service?"
  • "How do I save a running job I started without tmux?"
Last reviewed: 2026-07-02