When I run several background processes my output of the command jobs
is for example:
[1]- RUNNING nohup somecommand1 &
[2]+ RUNNING nohup somecommand2 &
What do the "+" and "-" chars after the job id mean?
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.
Job numbers refer to background processes that are currently running under your shell, while process IDs refer to all processes currently running on the entire system, for all users. The term job basically refers to a command line that was invoked from your shell.
The job IDs can be displayed using the jobs command, the -l switch displays the PID as well. Some kill implementations allow killing by job ID instead of PID. But a more sensible use of the job ID is to selectively foreground a particular process.
On an empty command line runs bg (so that Ctrl+Z Ctrl+Z suspends a program and immediately resumes it in the background).
It's in the man-page for jobs under STDOUT:
> man jobs
The character '+' identifies the job that would be used as a default for the fg or bg utilities; this job can also be specified using the job_id %+ or "%%" . The character '-' identifies the job that would become the default if the current default job were to exit; this job can also be specified using the job_id %-.
So the job marked with '+' is the one that will be activated by 'fg'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With