Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

marked as duplicate by Takkat, Florian Diesch, Eliah Kagan, hbdgaf, 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.

2 Answers

One solution is to use screen and detach from it:

sudo apt-get install screen    
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
add comment

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
add comment

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