Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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 nohup that you should prefix with your regular command (e.g. nohup gedit).

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 nohup.out is being created and all output from processes will be redirected to it.

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. nohup gedit &).

share|improve this answer
Also note, that once a job is running in the background (either through bg or an appended ampersand), you can use disown to prevent the shell from sending SIGHUP when terminating. – Michael Wild May 3 '12 at 12:00

You can use the nohup command to prevent a child process to be exited when you close the terminal. For instance nohup gcalctool. Nohup is for "No hang-up".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.