So I am well aware of nohup
and suffixing commands with &
to ensure that they go into the background.
However if I run a graphical application - sometimes using neither seems to do the job. So what can I prefix a program/command with to ensure that it keeps running after the terminal is closed?
If you want the application to keep running when you close the terminal window you should do:
You need both the
nohup
and the&
.when running a program in the background via the & operator it's still attached to your session and can be controlled with fg, bg, jobs and disown.
I also had some problems with nohup but disown might be the thing you're looking for.
When you run a program in background it has a job id:
That number in brackets [] is the interesting one. To detatch it from your session run
disown %n
with that number. For the above example:Now you can safely exit the terminal and the process will not be terminated.
For graphical applications, simply doing something like this should work (at least, it does for me)
chromium-browser&
For terminal applications, you should use something like
screen
ortmux
.Close the terminal, from which you started the graphical program, with