1

I was going through the GNU Screen manual and it says

When a program terminates, screen (per default) kills the window that contained it. If this window was in the foreground, the display switches to the previously displayed window; if none are left, screen exits

However in practice doesn't seem so. Neither for the screen nor for the windows. For example if I start a screen and run the program who or any other program, the program runs and terminates but the screen or window is still there. What am I reading wrong?

2
  • 1
    That you didn't start screen with who, but your shell, and that shell continues to live on.
    – muru
    May 16, 2020 at 7:46
  • whoever downvoted plz explain why so that I am more careful in future. Nowhere in the reference it was mentioned that it's about "the program" it starts with so it wouldn't be clear to a learner and I couldn't find a related question on SE either. So it's seems like a legitimate question to me!
    – Lavya
    May 16, 2020 at 11:00

1 Answer 1

3

If you start screen, then type who at the prompt, then it is the shell that runs in screen that executes who. screen will therefore not terminate until that shell terminates.

To make screen run who instead of your shell, invoke screen like

screen who

The same behavior may be observed with tmux:

tmux new-session who

... where new-session (or just new for short) is a tmux command that initiates a new tmux session, and which takes a shell command to run in that session as an argument.

1
  • thank you. clearer now. trying to get some grip on screen and their windows.
    – Lavya
    May 16, 2020 at 8:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .