Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I know you can use nohup to keep a job running after logging out, but what about a process that's already running?

Is there a way to change it's state, so that it continues to run even when I log out?

share|improve this question

In Bash, you could disown the process.

disown [-ar] [-h] [jobspec … ]     

Each jobspec is removed from the table of active jobs.

  • -h SIGHUP is not sent to the job if the shell receives a SIGHUP. current job .
  • -a all the -r running jobs.

See also: Shell stuff: job control and screen

If you use the bash shell, then you have an alternative (don't you always?) Instead of using nohup, just run the command normally, put it in the background one of the two ways we've discussed, and then disown -h the job.

$ tar cjf /backup/rob/home.tar.bz2 . &

[1] 32089
$ disown -h

You can then safely logout or close your terminal. As with nohup, if you close the terminal or logout, you will not be able to access that command directly using the jobs and %<N> or fg <N> commands..

Related posts on the Stack Exchange network:

share|improve this answer
The Z shell also has % substitution - eg your example could be typed as disown %[TAB] and zsh would expand it to disown %tar. Out of curiosity - does bash have a similar mechanism? – new123456 Nov 3 '11 at 0:50

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.