Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 11 down vote accepted

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
/tmp/script4

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

share|improve this answer
    
Thanks a lot, now it's totally clear. –  Phil Mar 1 '13 at 10:02
    
My pleasure, I'm glad I could help. –  jaume Mar 1 '13 at 11:34

Your Answer

 
discard

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.