Exercise 2: Finding and Rescuing a Job Started Outside Screen — Possible Solution =================================================================================== Terminal A (not in screen): $ yes > /dev/null Terminal B: $ pgrep -af "^yes" 43301 yes Prove it's not in screen: $ pstree -s -p 43301 systemd(1)───...───bash(43250)───yes(43301) No SCREEN process appears among its ancestors. Move it into screen: $ screen -S rescue $ reptyr 43301 # or: sudo reptyr 43301 if ptrace_scope is 1 (Terminal A's prompt usually returns once the process has moved.) Prove it is now in screen: Ctrl-a d # detach $ pstree -s -p 43301 systemd(1)───SCREEN(43320)───bash(43321)───...───yes(43301) The SCREEN(43320) ancestor matches the session in screen -ls. Finally, stop it: screen -r rescue, then Ctrl-C (it now listens to this window's keyboard), and exit. WHY THIS WORKS AS AN ANSWER ------------------------------ It uses pstree -s as before-and-after evidence, rather than assuming the move worked. `yes > /dev/null` is harmless but busy, so remember to stop it. The exact tree shape reptyr produces can vary.