Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I start a program from terminal with the following command:

<program name> &

But when I close the terminal the program will close too. How to escape the program closing?

share|improve this question

marked as duplicate by Takkat, Florian Diesch, Eliah Kagan, RobotHumans, Mitch Jul 14 '12 at 19:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I can write firefox in terminal and then close terminal without a problem – AWE Aug 19 '14 at 19:28

You can close the terminal by pressing Ctrl-D at the prompt instead of using the window controls. This will do what you want.

share|improve this answer
Good answer. I would have suggested the same. :o) – Fernhill Linux Project Jul 14 '12 at 19:32
Good answer. I would have suggested the same, if I had known about it. :-) ... Looking at the tree view of htop, it seems that this somehow removes the terminal from the parent node, and "promotes" the program to the parent's level. With gedit, its parent became "init", the top (or root) level of the tree. Thanks, it's nice to know this trick; I always used alt-F2 to run programs instead, but this might be more convenient. – Marty Fried Jul 14 '12 at 19:45

One solution is to use screen and detach from it:

sudo apt-get install screen    
<program name> &
ctrl-a ctrl-d (this detaches the screen session)

This is useful especially when starting programs on remote servers. You can then run screen -R to reattach. See this howto.

share|improve this answer

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