Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • 7
    Can you explain to me what exactly happens after each step?
    – omg
    Commented Jun 5, 2009 at 7:29
  • 14
    You press ctrl-Z. The system suspends the running program, displays a job number and a "Stopped" message and returns you to a bash prompt. You type the "disown -h %1" command (here, I've used a "1", but you'd use the job number that was displayed in the "Stopped" message) which marks the job so it ignores the SIGHUP signal (it will not be stopped by logging out). Next, type the "bg" command using the same job number. This resumes the running of the program in the background and a message is displayed confirming that. You can now log out and it will continue running... Commented Jun 5, 2009 at 10:23
  • 4
    ...You should be aware that when you use the "bg" command the result is the same as if you'd run your program in the background with an ampersand (&). It won't have any output to stdout so it should be made to write output to a file (nohup will redirect standard output to nohup.out or ~/nohup.out if you don't redirect it yourself). Commented Jun 5, 2009 at 10:35
  • 17
    i test it, and doesn't work.. exit when i'm logout... Commented Jul 6, 2011 at 23:08
  • 4
    @ButtleButkus: You should be able to see them with ps x Commented Oct 17, 2012 at 10:43