11

When I type firefox in terminal, it starts Firefox but the terminal "hangs".

What is happening behind the scenes?

Can I open Firefox from terminal and keep on using the same terminal tab for other things without closing Firefox?

AWE
  • 580
  • 2
    You would have found the solution yourself if you had done a bit of searching. Just put & after the command and it will run on background. –  Dec 03 '13 at 10:53
  • What is happening if I don't put &. How would you start firefox from the terminal if you had to and why? – AWE Dec 03 '13 at 13:32
  • 2
    Well, then the terminal will just hang as you noticed. –  Dec 03 '13 at 14:02
  • upvote for honest, no nonsense answer – AWE Dec 03 '13 at 14:36

4 Answers4

12

The terminal locks when you are running an application from it as long as the application is running. With the ampersand (&) you can start the application in the background and still use the terminal. Type:

user@host:~# firefox &

To start firefox in the background. Output of the application will still be in the terminal.

Or, if firefox is already running you can do this:

  1. Ctrl+z to put firefox into the backgroound.
  2. Type:

    jobs
    

    You should see your jobs like :

    [1]+  Stopped  firefox.
    
  3. Type:

    bg %1 
    

    (or number of your job)

chaos
  • 48,171
7

Use nohup firefox & to run firefox from terminal and you can use terminal for other process, if you close terminal, firefox will not quit.

If you get error like Another instance is running then use nohup firefox -P --no-remote & and create a new user profile and browse.

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
Ruban Savvy
  • 8,659
2

You can use the & symbol after your command to run it in background.

Vinz
  • 2,150
  • 14
  • 16
1

Use this command to run firefox in background as well you can exit the terminal but still the firefox will run.

hussain-->~#nohup firefox &

When you simply open the firefox then it will not return the prompt after closing the firefox only it will return the prompt.

Anthon
  • 79,293
Q_SaD
  • 111