How to run an app from the command line and carry on working? [duplicate]

Possible Duplicate:
How to clean launch a GUI app via the Terminal (so it doesn't wait for termination)?

For example, if I want to run Netbeans from the CLI, I can type:

$ /usr/local/netbeans-7.0/bin/netbeans

But by doing this, the command line is rendered useless until Netbeans has been shut down. Hitting CTRL+C to end the process will kill Netbeans and return the command line to the user but how do you launch applications while retaining control of the command line? Is it possible to run a task in the background while still using the command line?


You can put nohup in front of it and & behind it.

Nohup will take care of all the messages created by the command to not show up. The & will actually fork the command.


If you launch something from the command line and only later decide you want to keep working in your terminal without stopping the program, you can:

  • suspend the process with "crtl + z"
  • separate the process from your terminal (and de-suspend it) with "bg"

For example, suppose you launch firefox:

$ firefox

(now the terminal is unresponsive, so type the following)

$ <Ctrl-z>

$ bg

Now if you close the terminal, firefox does not close (because it has been "backgrounded").

Note: without the "bg", the program is suspended and unresponsive.