JOBS(1)                    POSIX Programmer's Manual                   JOBS(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       jobs -- display status of jobs in the current session

SSYYNNOOPPSSIISS
       jobs [[-l|-p]] [[_j_o_b___i_d...]]

DDEESSCCRRIIPPTTIIOONN
       The _j_o_b_s utility shall display the status of jobs that were started in
       the current shell environment; see _S_e_c_t_i_o_n _2_._1_2, _S_h_e_l_l _E_x_e_c_u_t_i_o_n
       _E_n_v_i_r_o_n_m_e_n_t.

       When _j_o_b_s reports the termination status of a job, the shell shall
       remove its process ID from the list of those ``known in the current
       shell execution environment''; see _S_e_c_t_i_o_n _2_._9_._3_._1, _E_x_a_m_p_l_e_s.

OOPPTTIIOONNSS
       The _j_o_b_s utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       The following options shall be supported:

       --ll        (The letter ell.) Provide more information about each job
                 listed. This information shall include the job number,
                 current job, process group ID, state, and the command that
                 formed the job.

       --pp        Display only the process IDs for the process group leaders of
                 the selected jobs.

       By default, the _j_o_b_s utility shall display the status of all stopped
       jobs, running background jobs and all jobs whose status has changed and
       have not been reported by the shell.

OOPPEERRAANNDDSS
       The following operand shall be supported:

       _j_o_b___i_d    Specifies the jobs for which the status is to be displayed.
                 If no _j_o_b___i_d is given, the status information for all jobs
                 shall be displayed. The format of _j_o_b___i_d is described in the
                 Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_0_4, _J_o_b
                 _C_o_n_t_r_o_l _J_o_b _I_D.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _j_o_b_s:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard error
                 and informative messages written to standard output.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       If the --pp option is specified, the output shall consist of one line for
       each process ID:


           "%d\n", <_p_r_o_c_e_s_s _I_D>

       Otherwise, if the --ll option is not specified, the output shall be a
       series of lines of the form:


           "[%d] %c %s %s\n", <_j_o_b_-_n_u_m_b_e_r>, <_c_u_r_r_e_n_t>, <_s_t_a_t_e>, <_c_o_m_m_a_n_d>

       where the fields shall be as follows:

       <_c_u_r_r_e_n_t> The character ''++'' identifies the job that would be used as a
                 default for the _f_g or _b_g utilities; this job can also be
                 specified using the _j_o_b___i_d %+ 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 _j_o_b___i_d %-. For other jobs, this field is
                 a <space>.  At most one job can be identified with ''++'' and at
                 most one job can be identified with ''--''.  If there is any
                 suspended job, then the current job shall be a suspended job.
                 If there are at least two suspended jobs, then the previous
                 job also shall be a suspended job.

       <_j_o_b_-_n_u_m_b_e_r>
                 A number that can be used to identify the process group to
                 the _w_a_i_t, _f_g, _b_g, and _k_i_l_l utilities. Using these utilities,
                 the job can be identified by prefixing the job number with
                 ''%%''.

       <_s_t_a_t_e>   One of the following strings (in the POSIX locale):

                 RRuunnnniinngg   Indicates that the job has not been suspended by a
                           signal and has not exited.

                 DDoonnee      Indicates that the job completed and returned exit
                           status zero.

                 DDoonnee(_c_o_d_e)
                           Indicates that the job completed normally and that
                           it exited with the specified non-zero exit status,
                           _c_o_d_e, expressed as a decimal number.

                 SSttooppppeedd   Indicates that the job was suspended by the SIGTSTP
                           signal.

                 SSttooppppeedd (SSIIGGTTSSTTPP)
                           Indicates that the job was suspended by the SIGTSTP
                           signal.

                 SSttooppppeedd (SSIIGGSSTTOOPP)
                           Indicates that the job was suspended by the SIGSTOP
                           signal.

                 SSttooppppeedd (SSIIGGTTTTIINN)
                           Indicates that the job was suspended by the SIGTTIN
                           signal.

                 SSttooppppeedd (SSIIGGTTTTOOUU)
                           Indicates that the job was suspended by the SIGTTOU
                           signal.

                 The implementation may substitute the string SSuussppeennddeedd in
                 place of SSttooppppeedd.  If the job was terminated by a signal, the
                 format of <_s_t_a_t_e> is unspecified, but it shall be visibly
                 distinct from all of the other <_s_t_a_t_e> formats shown here and
                 shall indicate the name or description of the signal causing
                 the termination.

       <_c_o_m_m_a_n_d> The associated command that was given to the shell.

       If the --ll option is specified, a field containing the process group ID
       shall be inserted before the <_s_t_a_t_e> field. Also, more processes in a
       process group may be output on separate lines, using only the process
       ID and <_c_o_m_m_a_n_d> fields.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The --pp option is the only portable way to find out the process group of
       a job because different implementations have different strategies for
       defining the process group of the job. Usage such as $(_j_o_b_s --pp)
       provides a way of referring to the process group of the job in an
       implementation-independent way.

       The _j_o_b_s utility does not work as expected when it is operating in its
       own utility execution environment because that environment has no
       applicable jobs to manipulate. See the APPLICATION USAGE section for
       _b_g.  For this reason, _j_o_b_s is generally implemented as a shell regular
       built-in.

EEXXAAMMPPLLEESS
       None.

RRAATTIIOONNAALLEE
       Both ""%%%%"" and ""%%++"" are used to refer to the current job. Both forms are
       of equal validity--the ""%%%%"" mirroring ""$$$$"" and ""%%++"" mirroring the
       output of _j_o_b_s.  Both forms reflect historical practice of the
       KornShell and the C shell with job control.

       The job control features provided by _b_g, _f_g, and _j_o_b_s are based on the
       KornShell. The standard developers examined the characteristics of the
       C shell versions of these utilities and found that differences exist.
       Despite widespread use of the C shell, the KornShell versions were
       selected for this volume of POSIX.1-2017 to maintain a degree of
       uniformity with the rest of the KornShell features selected (such as
       the very popular command line editing features).

       The _j_o_b_s utility is not dependent on the job control option, as are the
       seemingly related _b_g and _f_g utilities because _j_o_b_s is useful for
       examining background jobs, regardless of the condition of job control.
       When the user has invoked a _s_e_t ++mm command and job control has been
       turned off, _j_o_b_s can still be used to examine the background jobs
       associated with that current session. Similarly, _k_i_l_l can then be used
       to kill background jobs with _k_i_l_l %<_b_a_c_k_g_r_o_u_n_d _j_o_b _n_u_m_b_e_r>.

       The output for terminated jobs is left unspecified to accommodate
       various historical systems. The following formats have been witnessed:

        1. KKiilllleedd(_s_i_g_n_a_l _n_a_m_e)

        2. _s_i_g_n_a_l _n_a_m_e

        3. _s_i_g_n_a_l _n_a_m_e(ccoorreedduummpp)

        4. _s_i_g_n_a_l _d_e_s_c_r_i_p_t_i_o_n- ccoorree dduummppeedd

       Most users should be able to understand these formats, although it
       means that applications have trouble parsing them.

       The calculation of job IDs was not described since this would suggest
       an implementation, which may impose unnecessary restrictions.

       In an early proposal, a --nn option was included to ``Display the status
       of jobs that have changed, exited, or stopped since the last status
       report''. It was removed because the shell always writes any changed
       status of jobs before each prompt.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _S_e_c_t_i_o_n _2_._1_2, _S_h_e_l_l _E_x_e_c_u_t_i_o_n _E_n_v_i_r_o_n_m_e_n_t, _b_g, _f_g, _k_i_l_l, _w_a_i_t

       The Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_0_4, _J_o_b _C_o_n_t_r_o_l
       _J_o_b _I_D, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x
       _G_u_i_d_e_l_i_n_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                              JOBS(1)
