I'm curious about how terminals and processes work together. From what I understand, generally, killing a parent process doesn't automatically kill its child processes. However, when I run a program through the terminal, it launches as a child process of the terminal. So, if I close the terminal, it seems like the child processes also get terminated. Can someone explain why that happens?
2 Answers
Exiting the terminal sends a SIGHUP to the shell, which then kills all its child processes. If a process ignores this and continues running, it can turn into a zombie process owned by root. To prevent this from happening, you have options like starting the process with NOHUP, putting it into the background, or using `screen` to manage the session.
When you close a terminal, it sends a SIGHUP signal to all the child processes linked to it. This signal usually causes many I/O-related processes to terminate. If you want a program to keep running even after closing the terminal, you should look into using `&` to run it in the background or `nohup` to prevent it from receiving the SIGHUP signal. Alternatively, you could use a terminal multiplexer like `screen` or `tmux`.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures