Mostly, if I closed the current terminal, the sub_process are also closed. Of course, if I use suspend the process and use `bg JobID wakeup it, the process is divided with the terminal and run in background. So what the relationship between the current terminal and the process that is triggered by the terminal. Are they father-son or brothers? What's more, how could I use the command line to trigger a process which needn't attach to the terminal.
You can use the nohup command to prevent a child process to be exited when you close the terminal. For instance
You are right about the father-son behavior. Processes that you are starting from the command line are getting their signals from the terminal instance. Once you close the terminal it will send a HUP (hangup) signal to the depending processes.
This is very useful when you have only one terminal so that once you logout it will notify all processes that the user logged out and they should terminate their activity. However, in your case you want to process(es) to ignore this signal and continue their work even after the terminal has been closed. For that we have a special command called
You may also ask where does the output that went to console goes after a terminal is closed. Well, a file in your home directory called
Please notice, the nohup does not open the process in background so you will still need to add & postfix if you want it (e.g.