Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the difference between

$ nohup foo


$ foo &


$ foo &
$ disown
share|improve this question
Wait, you can disown without specifying a PID ? Great! –  ripper234 Nov 12 '10 at 11:20
There is also foo &! which should be equal to disowning it right from the start. –  user4514 Nov 18 '12 at 19:02
Bash does not support &!. –  Jonas Kongslund Jun 3 '13 at 4:35

1 Answer 1

up vote 98 down vote accepted

Using & causes the program to run in the background, so you'll get a new shell prompt instead of blocking until the program ends. nohup and disown are largely unrelated; they suppress SIGHUP (hangup) signals so the program isn't automatically killed when the controlling terminal is closed. nohup does this when the job first begins. If you don't nohup a job when it begins, you can use disown to modify a running job; with no arguments it modifies the current job, which is the one that was just backgrounded

share|improve this answer
Minor difference between nohup and disown: the disown command will remove it from your jobs list; nohup will not. –  Shawn J. Goff Nov 9 '10 at 16:41
nohup and disown both can be said to suppress SIGHUP, but in different ways. nohup makes the program ignore the signal initially (the program may change this). nohup also tries to arrange for the program not to have a controlling terminal, so that it won't be sent SIGHUP by the kernel when the terminal is closed. disown is purely internal to the shell; it causes the shell not to send SIGHUP when it terminates. –  Gilles Nov 9 '10 at 18:26
@Gilles, your comment is worth an answer of itself. –  lesmana Nov 10 '10 at 18:30
Just a clarification on @ShawnJ.Goff 's comment pertaining to disown removing the job from the jobs list. If you don't specify an option, it does remove it from the jobs list. However, if you specify the -h option, each jobspec is not removed from the table. Instead, it makes it so that SIGHUP is not sent to the job if the shell receives a SIGHUP. –  nojak Nov 13 '13 at 6:54
Just to clarify, using & does not give you a terminal, it detaches stdin from the process and causes it to run in the background, but both stdout and stderr is still attached to the current tty. This means that you may get text from different programs mixed up together, which can be quite annoying if you do gimp & and get lots of GTK+ errors while trying to use that tty for something else. –  Frank Jun 5 at 21:18

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.