Run long jobs, detach and reconnect to persistent terminal sessions across SSH connections. 30.04.2026 | reading time: 2 min Lost SSH sessions stop being a roadblock: use GNU Screen to create persistent terminal sessions that he can detach from and reattach to later, keeping programs running on the server. Real-world rescue Do this when the network is unreliable: start a named session, run the job, detach, and reattach from anywhere; for example use the commands below to demo the flow in one session ```bash $ ssh server.example.com $ screen -S longjob # now inside the screen session start a long task $ ./backup.sh & # detach the session Press Ctrl-a d # list sessions from any shell $ screen -ls There is a screen on: 1234.longjob (Detached) 1 Socket in /var/run/screen/S-user. # reattach later $ screen -r longjob ``` Key commands and tips Start with `screen -S name`, list with `screen -ls`, reattach with `screen -r name` or force detach with `screen -d -r`; use the default control key Ctrl-a then c to create a window and Ctrl-a n to move next, enable logging with `Ctrl-a H`, and tune behavior in a personal `.screenrc` file. Advanced uses Use screen for backgrounding tasks, simple terminal multiplexing, session sharing for pair-debugging, and scripted session startup; it is lightweight so it often exists on rescue systems where newer multiplexers are not installed. When to pick screen Choose screen on minimal servers or when compatibility matters, pick tmux when you want richer scripting and pane layouts, and prefer screen when you need a stable, well-tested tool that survives even terse recovery environments. Wrap-up and next step Try screen on a test host: create sessions, practice detach/reattach and save a `.screenrc` with favorite shortcuts; then expand your skills by studying more Linux tools and consider formal certification like CompTIA Linux+ or LPIC-1 with intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities processes troubleshooting scripting infrastructure