logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

jobs.1p (10456B)


  1. '\" et
  2. .TH JOBS "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. jobs
  12. \(em display status of jobs in the current session
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. jobs \fB[\fR-l|-p\fB] [\fIjob_id\fR...\fB]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR jobs
  21. utility shall display the status of jobs that were started in the
  22. current shell environment; see
  23. .IR "Section 2.12" ", " "Shell Execution Environment".
  24. .P
  25. When
  26. .IR jobs
  27. reports the termination status of a job, the shell shall remove its
  28. process ID from the list of those ``known in the current shell
  29. execution environment''; see
  30. .IR "Section 2.9.3.1" ", " "Examples".
  31. .SH OPTIONS
  32. The
  33. .IR jobs
  34. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  35. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  36. .P
  37. The following options shall be supported:
  38. .IP "\fB\-l\fP" 10
  39. (The letter ell.) Provide more information about each job listed. This
  40. information shall include the job number, current job, process group
  41. ID, state, and the command that formed the job.
  42. .IP "\fB\-p\fP" 10
  43. Display only the process IDs for the process group leaders of the
  44. selected jobs.
  45. .P
  46. By default, the
  47. .IR jobs
  48. utility shall display the status of all stopped jobs, running
  49. background jobs and all jobs whose status has changed and have not been
  50. reported by the shell.
  51. .SH OPERANDS
  52. The following operand shall be supported:
  53. .IP "\fIjob_id\fR" 10
  54. Specifies the jobs for which the status is to be displayed. If no
  55. .IR job_id
  56. is given, the status information for all jobs shall be displayed. The
  57. format of
  58. .IR job_id
  59. is described in the Base Definitions volume of POSIX.1\(hy2017,
  60. .IR "Section 3.204" ", " "Job Control Job ID".
  61. .SH STDIN
  62. Not used.
  63. .SH "INPUT FILES"
  64. None.
  65. .SH "ENVIRONMENT VARIABLES"
  66. The following environment variables shall affect the execution of
  67. .IR jobs :
  68. .IP "\fILANG\fP" 10
  69. Provide a default value for the internationalization variables that are
  70. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  71. .IR "Section 8.2" ", " "Internationalization Variables"
  72. for the precedence of internationalization variables used to determine
  73. the values of locale categories.)
  74. .IP "\fILC_ALL\fP" 10
  75. If set to a non-empty string value, override the values of all the
  76. other internationalization variables.
  77. .IP "\fILC_CTYPE\fP" 10
  78. Determine the locale for the interpretation of sequences of bytes of
  79. text data as characters (for example, single-byte as opposed to
  80. multi-byte characters in arguments).
  81. .IP "\fILC_MESSAGES\fP" 10
  82. .br
  83. Determine the locale that should be used to affect the format and
  84. contents of diagnostic messages written to standard error and
  85. informative messages written to standard output.
  86. .IP "\fINLSPATH\fP" 10
  87. Determine the location of message catalogs for the processing of
  88. .IR LC_MESSAGES .
  89. .SH "ASYNCHRONOUS EVENTS"
  90. Default.
  91. .SH STDOUT
  92. If the
  93. .BR \-p
  94. option is specified, the output shall consist of one line for each
  95. process ID:
  96. .sp
  97. .RS 4
  98. .nf
  99. "%d\en", <\fIprocess ID\fR>
  100. .fi
  101. .P
  102. .RE
  103. .P
  104. Otherwise, if the
  105. .BR \-l
  106. option is not specified, the output shall be a series of lines of the
  107. form:
  108. .sp
  109. .RS 4
  110. .nf
  111. "[%d] %c %s %s\en", <\fIjob-number\fR>, <\fIcurrent\fR>, <\fIstate\fR>, <\fIcommand\fR>
  112. .fi
  113. .P
  114. .RE
  115. .P
  116. where the fields shall be as follows:
  117. .IP "<\fIcurrent\fP>" 10
  118. The character
  119. .BR '\(pl'
  120. identifies the job that would be used as a default for the
  121. .IR fg
  122. or
  123. .IR bg
  124. utilities; this job can also be specified using the
  125. .IR job_id
  126. %+ or
  127. .BR \(dq%%\(dq .
  128. The character
  129. .BR '\-'
  130. identifies the job that would become the default if the current default
  131. job were to exit; this job can also be specified using the
  132. .IR job_id
  133. %\-. For other jobs, this field is a
  134. <space>.
  135. At most one job can be identified with
  136. .BR '\(pl'
  137. and at most one job can be identified with
  138. .BR '\-' .
  139. If there is any suspended job, then the current job shall be a
  140. suspended job. If there are at least two suspended jobs, then the
  141. previous job also shall be a suspended job.
  142. .IP "<\fIjob-number\fP>" 10
  143. A number that can be used to identify the process group to the
  144. .IR wait ,
  145. .IR fg ,
  146. .IR bg ,
  147. and
  148. .IR kill
  149. utilities. Using these utilities, the job can be identified by
  150. prefixing the job number with
  151. .BR '%' .
  152. .IP "<\fIstate\fP>" 10
  153. One of the following strings (in the POSIX locale):
  154. .RS 10
  155. .IP "\fBRunning\fR" 10
  156. Indicates that the job has not been suspended by a signal and has not
  157. exited.
  158. .IP "\fBDone\fR" 10
  159. Indicates that the job completed and returned exit status zero.
  160. .IP "\fBDone\fR(\fIcode\fR)" 10
  161. Indicates that the job completed normally and that it exited with the
  162. specified non-zero exit status,
  163. .IR code ,
  164. expressed as a decimal number.
  165. .IP "\fBStopped\fR" 10
  166. Indicates that the job was suspended by the SIGTSTP signal.
  167. .IP "\fBStopped\fR\ (\fBSIGTSTP\fR)" 10
  168. .br
  169. Indicates that the job was suspended by the SIGTSTP signal.
  170. .IP "\fBStopped\fR\ (\fBSIGSTOP\fR)" 10
  171. .br
  172. Indicates that the job was suspended by the SIGSTOP signal.
  173. .IP "\fBStopped\fR\ (\fBSIGTTIN\fR)" 10
  174. .br
  175. Indicates that the job was suspended by the SIGTTIN signal.
  176. .IP "\fBStopped\fR\ (\fBSIGTTOU\fR)" 10
  177. .br
  178. Indicates that the job was suspended by the SIGTTOU signal.
  179. .P
  180. The implementation may substitute the string
  181. .BR Suspended
  182. in place of
  183. .BR Stopped .
  184. If the job was terminated by a signal, the format of <\fIstate\fP> is
  185. unspecified, but it shall be visibly distinct from all of the other
  186. <\fIstate\fP> formats shown here and shall indicate the name or
  187. description of the signal causing the termination.
  188. .RE
  189. .IP "<\fIcommand\fR>" 10
  190. The associated command that was given to the shell.
  191. .P
  192. If the
  193. .BR \-l
  194. option is specified, a field containing the process group ID shall be
  195. inserted before the <\fIstate\fP> field. Also, more processes in a
  196. process group may be output on separate lines, using only the process
  197. ID and <\fIcommand\fP> fields.
  198. .SH STDERR
  199. The standard error shall be used only for diagnostic messages.
  200. .SH "OUTPUT FILES"
  201. None.
  202. .SH "EXTENDED DESCRIPTION"
  203. None.
  204. .SH "EXIT STATUS"
  205. The following exit values shall be returned:
  206. .IP "\00" 6
  207. Successful completion.
  208. .IP >0 6
  209. An error occurred.
  210. .SH "CONSEQUENCES OF ERRORS"
  211. Default.
  212. .LP
  213. .IR "The following sections are informative."
  214. .SH "APPLICATION USAGE"
  215. The
  216. .BR \-p
  217. option is the only portable way to find out the process group of a job
  218. because different implementations have different strategies for
  219. defining the process group of the job. Usage such as $(\c
  220. .IR jobs
  221. .BR \-p )
  222. provides a way of referring to the process group of the job in an
  223. implementation-independent way.
  224. .P
  225. The
  226. .IR jobs
  227. utility does not work as expected when it is operating in its own
  228. utility execution environment because that environment has no
  229. applicable jobs to manipulate. See the APPLICATION USAGE section for
  230. .IR "\fIbg\fR\^".
  231. For this reason,
  232. .IR jobs
  233. is generally implemented as a shell regular built-in.
  234. .SH EXAMPLES
  235. None.
  236. .SH RATIONALE
  237. Both
  238. .BR \(dq%%\(dq
  239. and
  240. .BR \(dq%+\(dq
  241. are used to refer to the current job. Both forms are of equal
  242. validity\(emthe
  243. .BR \(dq%%\(dq
  244. mirroring
  245. .BR \(dq$$\(dq
  246. and
  247. .BR \(dq%+\(dq
  248. mirroring the output of
  249. .IR jobs .
  250. Both forms reflect historical practice of the KornShell and the C shell
  251. with job control.
  252. .P
  253. The job control features provided by
  254. .IR bg ,
  255. .IR fg ,
  256. and
  257. .IR jobs
  258. are based on the KornShell. The standard developers examined the
  259. characteristics of the C shell versions of these utilities and found
  260. that differences exist. Despite widespread use of the C shell, the
  261. KornShell versions were selected for this volume of POSIX.1\(hy2017 to maintain a degree of
  262. uniformity with the rest of the KornShell features selected (such as
  263. the very popular command line editing features).
  264. .P
  265. The
  266. .IR jobs
  267. utility is not dependent on the job control option, as are the
  268. seemingly related
  269. .IR bg
  270. and
  271. .IR fg
  272. utilities because
  273. .IR jobs
  274. is useful for examining background jobs, regardless of the condition of
  275. job control. When the user has invoked a
  276. .IR set
  277. .BR +m
  278. command and job control has been turned off,
  279. .IR jobs
  280. can still be used to examine the background jobs associated with that
  281. current session. Similarly,
  282. .IR kill
  283. can then be used to kill background jobs with
  284. .IR kill
  285. %<\fIbackground job number\fP>.
  286. .P
  287. The output for terminated jobs is left unspecified to accommodate
  288. various historical systems. The following formats have been witnessed:
  289. .IP " 1." 4
  290. .BR Killed (\c
  291. .IR "signal name" )
  292. .IP " 2." 4
  293. .IR "signal name"
  294. .IP " 3." 4
  295. .IR "signal name" (\c
  296. .BR coredump )
  297. .IP " 4." 4
  298. .IR "signal description" \-
  299. .BR "core dumped"
  300. .P
  301. Most users should be able to understand these formats, although it
  302. means that applications have trouble parsing them.
  303. .P
  304. The calculation of job IDs was not described since this would suggest
  305. an implementation, which may impose unnecessary restrictions.
  306. .P
  307. In an early proposal, a
  308. .BR \-n
  309. option was included to ``Display the status of jobs that have changed,
  310. exited, or stopped since the last status report''. It was removed
  311. because the shell always writes any changed status of jobs before each
  312. prompt.
  313. .SH "FUTURE DIRECTIONS"
  314. None.
  315. .SH "SEE ALSO"
  316. .IR "Section 2.12" ", " "Shell Execution Environment",
  317. .IR "\fIbg\fR\^",
  318. .IR "\fIfg\fR\^",
  319. .IR "\fIkill\fR\^",
  320. .IR "\fIwait\fR\^"
  321. .P
  322. The Base Definitions volume of POSIX.1\(hy2017,
  323. .IR "Section 3.204" ", " "Job Control Job ID",
  324. .IR "Chapter 8" ", " "Environment Variables",
  325. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  326. .\"
  327. .SH COPYRIGHT
  328. Portions of this text are reprinted and reproduced in electronic form
  329. from IEEE Std 1003.1-2017, Standard for Information Technology
  330. -- Portable Operating System Interface (POSIX), The Open Group Base
  331. Specifications Issue 7, 2018 Edition,
  332. Copyright (C) 2018 by the Institute of
  333. Electrical and Electronics Engineers, Inc and The Open Group.
  334. In the event of any discrepancy between this version and the original IEEE and
  335. The Open Group Standard, the original IEEE and The Open Group Standard
  336. is the referee document. The original Standard can be obtained online at
  337. http://www.opengroup.org/unix/online.html .
  338. .PP
  339. Any typographical or formatting errors that appear
  340. in this page are most likely
  341. to have been introduced during the conversion of the source files to
  342. man page format. To report such errors, see
  343. https://www.kernel.org/doc/man-pages/reporting_bugs.html .