Exercise 2: Seeing Inside a Detached Session — Possible Solution ================================================================= Create the session without attaching (Chapters 8 and 9 cover these options in detail): screen -dmS jobs sleep 2000 # detached session, window 0 screen -S jobs -X screen top # add window 1 running top Inspect it: $ screen -ls 61007.jobs (Detached) $ pstree -p -a 61007 SCREEN,61007 -dmS jobs sleep 2000 ├─sleep,61008 2000 └─top,61015 The two children of the SCREEN server are the programs in its two windows. Because each window was started with a command rather than a shell, the programs appear directly under SCREEN, with no bash in between (compare the chapter's example, where each window was a shell). (Clean up afterwards with: screen -S jobs -X quit) WHY THIS WORKS AS AN ANSWER ------------------------------ It uses the session ID's PID as the root for pstree, which is the key technique, and explains why the tree shape depends on how each window was started.