How can I run a command from the terminal without blocking it?
There are different ways to run a terminal program and continue using the terminal:
- You can open another terminal tab (right-click, then select "Open New Tab").
- You can append
&
to the command you run. Be aware that you will not see text output to the terminal, such as error messages. - You can type Ctrl-Z and then run
bg
. This has the same effect as runningcommand &
- You can run
nohup command &
and then press enter. (Thanks to ccpizza, see comments below.)
However, pressing Alt-F2 and then running your command from the GUI is usually considered best practice - there is no terminal at all!
Note that when using &
(not nohup
), closing the terminal will still terminate the application unless you run disown
afterwards.
EDIT: It looks like using nohup
will sometimes leave little droppings in your home folder. What would normally have been logged to the terminal is apparently saved to a file in ~/.
~~
A simple way to run a program in the background is program-name & disown
, which will drop you to a terminal which can be closed without killing the process.
You can run the command with a & after.
For example:
thunderbird &
See Here for more info.
You can use setsid
to run program in a new session with addition to &>/dev/null
so you will not receive any log messages.
So it would be like
setsid program-name &>/dev/null