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

When I leave a terminal via Ctrl+D and there are jobs in the background I get There are stopped jobs for the first time, but when I press Ctrl+D again, the jobs get killed.

Can I disable the latter feature somehow, so that bash wouldn't allow me to leave a terminal at all if there are stopped jobs?

share|improve this question
Have you tried screen? You can detach a console and even keep foreground-processes running. Even though this is not the answer to you question, it might be helpful. – fragmentedreality Dec 18 '12 at 13:29
can you start the job and add ampersand at the end of the command? tcpdump -w out.pcap & this should run even after exiting shell - it works for me – mnmnc Dec 18 '12 at 13:35
I am sorry, I was misanderstood. I was saying about processes stopped with ctrl-D, not the ones started in background. – zefciu Dec 19 '12 at 8:34

run :

nohup <command> &

nohup is "no hangup"

After seeing your updated question, then the above isn't going to work for you. You could try running the job as usual from the command line, then doing a CTRL-Z (which will pause the running program), then issuing a bg %1 (%1 being the last job you created). This will effectively let your program continue in the background. Now you have to detach the job from your session by running disown -h. This will instruct the shell to dis-associate the running job from your session and prevent any SIGHUP's being sent to it.

share|improve this answer

I haven't found a way of stopping bash from killing jobs on the second exit but to help I have added a job count to my prompt as per which might make me less likely to mash ctrl-D

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.