Normally when you use the terminal for run a program, if you want close terminal, this will also close the running program. To avoid this behavior, there is a small trick. |
Suppose you opened nautilus from a terminal by running:
Nautilus
Now you want to close the terminal without closing the Nautilus window. To do this, press Ctrl + z in the terminal and run the following commands:
disown -h% 1
bg 1
Once that is done, you can close the terminal without affecting the program you opened from the terminal.
As Rafa (one of our readers) suggests, another similar method but that does not have exactly the same effects is to add the parameter & at the end of the command you want to execute. For example, to open nautilus it would be like this:
nautilus &
This means that you can continue to use the terminal after running the program but, unlike the previous method, closing the terminal will also close the executed program.
xD already saved me this tips thank you very much again 😀
Great, thanks a lot for the tips ^ __ ^
It's a good tip ..
Good post
Thanks Envi! I already updated the article so that there are no doubts and to be clearer ...
Hug! Paul.
This is not really so. The process runs in the background leaving the terminal free, but the moment the terminal closes the process ends.
http://hatteras.wordpress.com/2011/09/16/cerrar-la-terminal-sin-que-se-cierre-el-programa-en-ejecutado-con-ella/
If you can do it as a script let's say that in bash how are the parameters then programs ./run nautilus
then inside of you
script #! / bin / bash
$1 &
then the $ 1 works as a parameter and passes it the name of the program you want to execute, or you modify it with the lines
disown -h% 1
bg 1 but there is everyone's taste I prefer nautils & o conky & greetings 😀
I've been looking for this for a long time! Thank you so much for sharing it!
You are right Rafa! I have already incorporated your contribution in the article.
Hug! Paul.
As much as I tried it, it does not accept this command, but it works very well for me when I add "&" after the command to open the program "nautilus &"
or simply put "nautilus &" and you can close the xD terminal because you leave it running in an independent process, that's what the "&" is for
Good tip!
Another good tip
An alternative is to use programs like tmux or screen.
What exactly does each command mean? What do they do? 'bg' I imagine would be to put in BackGround whatever the console was.
And thank you very much Pablo. It will be useful to many of us, I think.
this trick is a bit cryptic the best is:
nohup nautilus and now you can close the terminal, disown is to disassociate the jobs from the terminal. And if you want it to work in the background:
nohup nautilus & and you can continue working in the terminal or close it.
Is there a way to do it in a script?