How to start GUI linux programs from the command line, but separate from the command line?
In bash
, detach
is a built-in, used as follows:
emacs &
detach %+ # or % + the number in brackets printed after the above
In zsh
, you can background and detach in a single operation:
emacs &|
Append &
to the commandline:
emacs &
This will put emacs in the background and enable you to continue using your terminal.
Note that this will still leave emacs as a sub-process of your terminal, and when you exit the terminal it will also exit emacs. To avoid this, type:
(emacs &)
The parentheses tell the terminal to detach the emacs process from the terminal.
Still, stdout and stderr messages from the program will show up on the terminal. To prevent this, use:
(emacs &> /dev/null &)
Use nohup
.
Like this: nohup amarok &
Hope this helps.