4

This question already has an answer here:

If I execute the following command in LXTerminal:

gnome-terminal &

gnome-terminal gets opened. But as soon as I close the LXTerminal, gnome-terminal will be closed as well because it's a child process. Is there any way to open the second process independently?

marked as duplicate by slm, Anthon, Patrick, jasonwryan, rahmu Nov 16 '13 at 15:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

It's not possible to start a process without it being the child. When you execute an external command, under the hood the shell calls fork() followed by execvp(). You can prevent it from getting killed when the parent shell dies.

One way is to use nohup:

nohup gnome-terminal &

Another option if you are using bash is to disown the process:

gnome-terminal & disown
  • nohup didn't seem to work for me but disown did. – Chris Stryczynski Jun 6 '17 at 14:27
-1

Yes just try to open this as follow.

$ sudo gnome-terminal &

So that both the terminals are available to you for work. But remember not to close the Parent terminal, as it will close the child terinal.

I is possible with nohup.

$ nohup gnome-terminal &
$ exit
  • 3
    I think you missed the point of the question and even added an unnecessary sudo. – jordanm Nov 16 '13 at 5:55
  • It is not possible to open child process independently. You are asking to kill the parent process, how can a child process will survive Meysam. – Aditya Nov 16 '13 at 6:00
  • "It is not possible to open child process independently". Are you definitely sure it's not possible? – Meysam Nov 16 '13 at 6:02
  • Yes i am definitely sure as per my knowledge. You can use that terminal but can not close that terminal. – Aditya Nov 16 '13 at 6:04
  • @Meysam - all processes are children, with the exception of init. – jordanm Nov 16 '13 at 6:05

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