Ubuntu – How to cleanly launch a GUI app via the Terminal

command linegui

Some GUI apps launch cleanly via the Terminal command line, but some don't, and they cause the Terminal to wait for the app to terminate. Even then, some don't "release" the command line.

The mysterious ampersand & suffix seems to cause the terminal to put the process into the background (but I'm not sure what happens there).

Is there a way to launch an app via the Terminal so that there is no "hang on" effect, just like launching something via Alt+F2?

I'd like to have the command line available again immediately, without something still in the background and printing in the terminal.

Best Answer

In gedit's case, I just keep a copy open all the time. As long as you have an existing copy running, launching gedit calls from the terminal and then closing the terminal won't kill gedit.

For other things, what other people have said would work too. I'm a fan of nohup... But if you need a terminal you can detach but then re-attach to, you want to look at screen.

  1. Run it in a terminal and then run something that keeps pushing output. I use the Django development server but irssi or even watch uptime would be good examples.
  2. Kill the terminal and start a new one.
  3. Run screen -r and BOOM, you're back in.

screen is a lot bigger than that and you can combine it with byobu for a better terminal experience. Read around.