Sample Header Ad - 728x90

Surprise: Interactive Bash runs commands in a separate Process Group

3 votes
1 answer
346 views
I am surprised that at least from Bash 4.4.19, Interactive Bash runs commands in a separate session, see following process list after I run sleep 8888:
PGID    PID       PPID
3150071 3150071  252603     -bash
3194323 3194323 3150071       sleep 8888
You can see the PGID of sleep does not equal to the bash, while its PPID does. The test is done on Ubuntu Bionic. Is there any documentation about this behavior change? or it has been acting this way since the beginning? Running commands in a separate session means that the SIGHUP effects does not happen at all when bash exits, maybe this is why https://www.sobyte.net/post/2022-04/linux-nohup-setsid-disown/#about- says > In fact, on newer versions of bash, bash does not send SIGHUP commands to background programs. That means that any process running in the background ending with & will not be exited by the SIGHUP signal for terminal exit. EDIT: I should use the term "process group" instead of "session".
Asked by osexp2000 (622 rep)
May 29, 2023, 06:07 AM
Last activity: May 29, 2023, 07:06 AM