I ran this command to try and get my python program to run in the background and let me exit the SSH connection I am using:

nohup python files.py >> files.log &

I then check ps to check it worked

$ ps a
13059 pts/0    Ss     0:00 -bash
13327 pts/0    R+     0:00 ps a
[1]+  Exit 1                  nohup python files.py >> files.log

What does this [1]+ Exit 1 mean?

And how can I run my program in the background letting me exit correctly?

2 Answers 2


When you use the & at the end of a command in bash, it runs the command in the background. The [1]+ Exit 1 means that job 1 exited with status 1. The number between the [] is the job number, and the number after Exit is the exit status. If no exit status is shown, it means the command exited with status 0.

The reason you don't see this until you run another command is because by default the status of a completed backgrounded command is not shown until the prompt is updated. This means after another command exits, or you simply press <ENTER> on an empty prompt.

You also do not need to use the nohup. Bash will only HUP a process when the shell itself receives a HUP. This doesn't happen if you exit cleanly (via exit, or CTRL+D).
However you can also use the disown builtin to make it so specific jobs don't get a HUP.
Lastly you can also set a SIGHUP handler to disown all jobs when the shell gets a HUP by doing function sighup { disown -a; exit 0; }; trap sighup HUP.

  • 3
    No nohup is not for use when the shell doesn't have a & operator, it is to immune a process to the HUP signal sent when their parent shell or session leader terminates. Mar 25, 2013 at 21:15
  • @StephaneChazelas Please see man 1 nohup, it specifically mentions this. & is quite capable of not HUPing backgrounded jobs.
    – phemmer
    Mar 25, 2013 at 21:23
  • My man page doesn't. Maybe you're referring to the GNU or BSD nohup man page comment saying that some shells (like (t)csh) have a builtin nohup command that would supersede it. Mar 25, 2013 at 21:30
  • 1
    It's not needed for bash, which can disown the job via the disown builtin.
    – jordanm
    Mar 25, 2013 at 21:35
  • 2
    @ACarter no, the exit 1 generally means abormal termination. Programs which exit properly normally exit with status 0. Though the script can really do whatever it wants.
    – phemmer
    Mar 26, 2013 at 3:59

Patrick's answer is correct, although Stéphane's point about nohup is important for users with differing versions. However, the significance of the + (plus) symbol was not given. Here, it indicates it is the "current" job. For instance, if I were to submit 3 commands at once as:

$ sleep 5&
[1] 29056
$ sleep 5&
[2] 29091
$ sleep 5&
[3] 29147

Then wait 5 seconds, and hit return, the output is:

[1]   Done                    sleep 5
[2]-  Done                    sleep 5
[3]+  Done                    sleep 5

As Patrick explained, the number between square brackets is an ordered job number. The + is only given for the latest job and the - is given for the job preceding it. All other jobs do not have any notation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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