If I start a process with an ampersand (&) at the end, it'll be forked to background. When it finishes, I get an output similar to

[1]+  Fertig   my_script

I have a localized distribution, but this shouldn't matter.

What I see is the job ID in square brackets followed by a plus (+).

If I have multiple jobs started in parallel, I get

[1]-  Fertig   my_script
[2]+  Fertig   my_script

Now I have a minus (-) for the fist job and a plus (+) for the second one.

I wonder, what those +/- mean.

Couldn't find any answer using internet search engines.


From man bash:

In output pertaining to jobs (e.g., the output of the jobs command), the current job is always flagged with a +, and the previous job with a -.

That is, the job flagged with a + is the one that was sent to the background last.

It is also the one that will be brought into the foreground when fg is used without arguments:

$ /tmp/script &
[1] 9871
$ /tmp/script2 &
[2] 9876
$ /tmp/script3 &
[3] 9881
$ /tmp/script4 &
[4] 9886
$ jobs
[1]   Running                 /tmp/script &
[2]   Running                 /tmp/script2 &
[3]-  Running                 /tmp/script3 &
[4]+  Running                 /tmp/script4 &
$ fg

The job flagged with a - was sent to the background second last. Other background jobs are not flagged.

  • My pleasure, I'm glad I could help. – jaume Mar 1 '13 at 11:34
  • 1
    So, the + is useful in saying what the fg/bg commands will do, but is the - useful for anything? – tsbertalan Jan 20 '16 at 5:15
  • @tsbertalan I agree, I can't see any use for it. I find it confusing, too, I'd rather expect the - to identify the job sent first to the background, but maybe it's just me... – jaume Jan 20 '16 at 7:39
  • I sometimes see two pluses or two minuses there. Does not really fit the 'last' or 'current' definition. That's bash 4.3.42. – Jan-Philip Gehrcke Feb 15 '16 at 19:16
  • 11
    @tsbertalan I do Ctrl+Z, then fg - to switch between two jobs. The minus sign comes in handy. – cozyconemotel Jul 6 '16 at 10:08

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.