What do the + and – symbols mean when executing the “jobs” command in Unix?… here is a solution to the problem.
What do the + and – symbols mean when executing the “jobs” command in Unix?
When I run the job command in CUI to check the job. I will get the following result.
[4]- Stopped Passwd.
[5]+ Stopped Cat > d1.
I don’t understand, why use +
and -
?
Can someone explain it to me?
Solution
Technically, this is specific to the shell you’re using (bash
I suspect), but as far as I know, all shells are assigned the same meaning here, taken from venerable1 csh
:+
is the “latest” job, fg
The job without parameters resumes, and - is the
“previous” job. When the Current job completes, the previous job becomes the current job.
You can also refer to them as %+ and %- in the fg and bg
commands, and use %- and %+ as commands (while % without parameters, or %%, means the
same as
%+
.)
Same).
1 or some other less flattering adjective. 🙂