Exercise 1: Detaching and Reattaching a Running Loop — Possible Solution ========================================================================= Commands: screen -S counter # start a named session while true; do date; sleep 5; done # inside the session (press Ctrl-a, then d) # detach [detached from 12345.counter] # screen's message # wait about a minute, then: screen -r counter # reattach After reattaching, the window shows a date line roughly every five seconds, including the lines printed while you were detached. The loop never stopped. To finish cleanly: (press Ctrl-c) # stop the loop exit # close the shell [screen is terminating] Because the shell was the session's only window, closing it ends the session. WHY THIS WORKS AS AN ANSWER ------------------------------ The timestamps that appear while you were away are direct proof the job kept running during the detach. It also shows the difference between detaching (Ctrl-a d, keeps running) and exiting (ends the session).