I need to run Firefox browser from terminal. Browser works fine, but terminal still waits for Firefox to return and if I do CTRL+C, it terminates Firefox. How to run command to make Firefox work independently from terminal?

  • Just add an ampersand sign at the end of the command. This is shell basics... – trve.fa7ad Jan 17 '15 at 12:34

Firefox 35 on Ubuntu 14.04 detaches itself from the shell, still printing errors though, to eliminate that output, try:

firefox >/dev/null 2>&1 www.google.com &

>/dev/null makes firefox's 'stdout' text stream be sent to "nowhere",
2>&1 makes 'stderr' be sent to the same place,
& detaches firefox from the shell.

With Bash "job control" of a long running process, e.g. find on / as in:

find -printf "%p\n" / >$HOME/LIST-OF-FILES.txt

... at any time before it finishes, you can do this:
Hold Ctrl and hit Z

[1]+  Stopped                 find ...

will be printed and the shell prompt will reappear...
type bg and press enter to have find continue run in the background.
Note that errors and warnings will still be printed, as in...

find: /run/lightdm: Permission denied

To stop those from appearing, add 2>/dev/null to the command line.

Another alternative to launch GUI based software is

xdg-open firefox ...

... this is more equal to actually clicking on an icon in your OS.

NOTE: Ubuntu. There are various variants of this for other Linux-variants, and MacOS.

Look up "job control" in http://www.tldp.org/LDP/abs/html/abs-guide.html - for more info.

  • This works fine - I can work with firefox and terminal. But if I close terminal firefox is also killed. How to solve this? – vico Jan 17 '15 at 17:02
  • Check addition above, I hope it will help you - not checked. – Hannu Jan 17 '15 at 17:18


firefox &

It will create firefox process in background and you can work in terminal


Ctrl+Z is what you're looking for and then afterwards type bg Enter

Alternatively (but you'll take a bit of getting used to it) is typing firefox& instead of firefoxCtrl+Z bg Enter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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