Regain control after opening firefox via terminal [duplicate]
The obvious way to go is to launch such applications in background by adding an &
sign to the end of the command, like this:
firefox &
Please note that Firefox is now a child process of your shell and your terminal window. If you exit them, Firefox gets killed if it's still running. To avoid this and make sure it continues running even after closing the terminal, you must disown
it:
firefox & disown
If you already started firefox
(or any other application) in foreground, you can still send it to the background though. Focus the terminal and hit Ctrl+Z. This freezes the foreground application and gets you back to the shell. You can now immediately run the command bg
to send the just frozen process to the background and let it go on running.
You can type
firefox &
to tell firefox to run in the background, then you can keep using your terminal session...
Edit: And @ByteCommander has explained this much more thoroughly than me.
But sometimes Firefox (or another process that has been told to run in the background) will print some warnings and so on to the terminal, even if the process is running in the background and has been disown
ed. If you don't want that you can tell it to be quiet by redirecting stdout and stderr
firefox >/dev/null 2>&1 &
and disown
if you like. This will give you the PID of the child process and send any output from it straight to data Nirvana (@Videonauth's phrase), so you can carry on in the blissful certainty that you won't be interrupted. Note that you have to do this when starting a process; it can't be added later.