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.

Which methods exist to keep a command that was started from shell on running after logging out from from shell?

share|improve this question

4 Answers 4

up vote 8 down vote accepted
  • To put the application into the background, use &

    command &

  • If you wish to close the terminal, and keep the application running, you can use several options.

    screen Install screen dtach Install dtach and nohup.

    nohup command &

  • Screen is helpful as you can re-start a session and dtach is fun as well.

  • Look at the following links for more informations


share|improve this answer
doesnt adding an & at the end of the command work too? –  theTuxRacer Dec 24 '10 at 10:35
@Kaustubh-P using & is often a good habbit to close terminals via the 'exit' command, not hitting the X close button.& makes the command run in thebackground.But if the parent shell closes. that can still force the background programs to exit. –  karthick87 Dec 24 '10 at 10:40

A useful (bash?) command is disown. the nice thing about it is that it works for an already running job (by the way, you disown jobs, not processes, so you need to do a ctrl-Z, bg before running disown on your job. For example, imagine yourself doing the following:

local % ssh some.where.com
remote % verylongscript.sh

Now you realize that you need to go but don't want the script to be killed upon exiting, so you

remote % bg
remote % disown
remote % exit
local %

Now, on remote, your script is still running.

share|improve this answer

Use the nohup command like this:

nohup gedit /home/user/file.txt &
share|improve this answer

I use

nohup mycommand &

For example to bring up a VirtualBox virtual server I type the following in a remote shell (which I close then):

nohup VBoxHeadless --startvm "myvm" --vrdp=off &

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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