Keep processes after terminate your ssh sessions
A quick how-to to maintain app processes when you want to terminate your ssh sessions

  Jul 08, 2017 -   read
  software, programming, ssh, http, screen, linux

Wondering how to keep your ssh processes after you terminate a session?

Steps by steps guide

  • ssh into your remote server, type screen then start any long running process you want.
    • For example, watching a directory for new files watch -d ls -lAhFv <dir>
  • Press Ctrl-A (^-A) then Ctrl-D (^-D)
    • This will detach your screen session but leave your processes running. You can now log out of the remote server.
  • When you want to resume your session, log on again and type screen -r
    • This will resume your screen session, and you can see the output of your long running process.


Dang Chien
Software engineer, solution architect and Agile practitioner.
Do you find this article helpful ❤️ ? Support me with a coffee via, give me a shout out on Twitter at @dangchien87, or help to share this article instead.