Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/jobs.1
          +++ new/usr/src/man/man1/jobs.1
↓ open down ↓ 36 lines elided ↑ open up ↑
  37   37  .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38   38  .\" If applicable, add the following below this CDDL HEADER, with the
  39   39  .\" fields enclosed by brackets "[]" replaced with your own identifying
  40   40  .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41   41  .\"
  42   42  .\"
  43   43  .\" Copyright 1989 AT&T
  44   44  .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
  45   45  .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
  46   46  .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
       47 +.\" Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
  47   48  .\"
  48      -.TH JOBS 1 "Nov 2, 2007"
       49 +.TH JOBS 1 "Feb 9, 2021"
  49   50  .SH NAME
  50   51  jobs, fg, bg, stop, notify \- control process execution
  51   52  .SH SYNOPSIS
  52      -.SS "sh"
  53      -.LP
  54      -.nf
  55      -\fBjobs\fR [\fB-p\fR | \fB-l\fR] [% \fIjob_id\fR...]
  56      -.fi
  57   53  
  58      -.LP
  59      -.nf
  60      -\fBjobs\fR \fB-x\fR \fIcommand\fR [\fIarguments\fR]
  61      -.fi
  62      -
  63      -.LP
  64      -.nf
  65      -\fBfg\fR [% \fIjob_id\fR...]
  66      -.fi
  67      -
  68      -.LP
  69      -.nf
  70      -\fBbg\fR [% \fIjob_id\fR...]
  71      -.fi
  72      -
  73      -.LP
  74      -.nf
  75      -\fBstop\fR % \fIjob_id\fR...
  76      -.fi
  77      -
  78      -.LP
  79      -.nf
  80      -\fBstop\fR \fIpid\fR...
  81      -.fi
  82      -
  83   54  .SS "csh"
  84      -.LP
  85   55  .nf
  86   56  \fBjobs\fR [\fB-l\fR]
  87   57  .fi
  88   58  
  89   59  .LP
  90   60  .nf
  91   61  \fBfg\fR [% \fIjob_id\fR]
  92   62  .fi
  93   63  
  94   64  .LP
↓ open down ↓ 9 lines elided ↑ open up ↑
 104   74  .LP
 105   75  .nf
 106   76  \fBstop\fR % \fIjob_id\fR...
 107   77  .fi
 108   78  
 109   79  .LP
 110   80  .nf
 111   81  \fBstop\fR \fIpid\fR...
 112   82  .fi
 113   83  
 114      -.SS "ksh"
 115      -.LP
 116      -.nf
 117      -\fBjobs\fR [\fB-lnp\fR] [% \fIjob_id\fR...]
 118      -.fi
 119      -
 120      -.LP
 121      -.nf
 122      -\fBfg\fR [% \fIjob_id\fR...]
 123      -.fi
 124      -
 125      -.LP
 126      -.nf
 127      -\fBbg\fR [% \fIjob_id\fR...]
 128      -.fi
 129      -
 130      -.LP
 131      -.nf
 132      -\fBstop\fR % \fIjob_id\fR...
 133      -.fi
 134      -
 135      -.LP
 136      -.nf
 137      -\fBstop\fR \fIpid\fR...
 138      -.fi
 139      -
 140   84  .SS "ksh93"
 141      -.LP
 142   85  .nf
 143   86  \fBjobs\fR [\fB-lnp\fR] [\fIjob_id\fR...]
 144   87  .fi
 145   88  
 146   89  .LP
 147   90  .nf
 148   91  \fBfg\fR [\fIjob_id\fR...]
 149   92  .fi
 150   93  
 151   94  .LP
 152   95  .nf
 153   96  \fBbg\fR [\fIjob_id\fR...]
 154   97  .fi
 155   98  
 156   99  .SH DESCRIPTION
 157      -.SS "sh"
 158      -.sp
 159      -.LP
 160      -When Job Control is enabled, the Bourne shell built-in \fBjobs\fR reports all
 161      -jobs that are stopped or executing in the background. If \fB%\fR\fIjob_id\fR is
 162      -omitted, all jobs that are stopped or running in the background is reported.
 163      -The following options modify or enhance the output of \fBjobs\fR:
 164      -.sp
 165      -.ne 2
 166      -.na
 167      -\fB\fB-l\fR\fR
 168      -.ad
 169      -.RS 6n
 170      -Reports the process group \fBID\fR and working directory of the jobs.
 171      -.RE
 172      -
 173      -.sp
 174      -.ne 2
 175      -.na
 176      -\fB\fB-p\fR\fR
 177      -.ad
 178      -.RS 6n
 179      -Reports only the process group \fBID\fR of the jobs.
 180      -.RE
 181      -
 182      -.sp
 183      -.ne 2
 184      -.na
 185      -\fB\fB-x\fR\fR
 186      -.ad
 187      -.RS 6n
 188      -Replaces any \fIjob_id\fR found in \fIcommand\fR or \fIarguments\fR with the
 189      -corresponding process group \fBID\fR, and then executes \fIcommand\fR passing
 190      -it \fIarguments\fR.
 191      -.RE
 192      -
 193      -.sp
 194      -.LP
 195      -When the shell is invoked as \fBjsh\fR, Job Control is enabled in addition to
 196      -all of the functionality described previously for \fBsh\fR. Typically Job
 197      -Control is enabled for the interactive shell only. Non-interactive shells
 198      -typically do not benefit from the added functionality of Job Control.
 199      -.sp
 200      -.LP
 201      -With Job Control enabled every command or pipeline the user enters at the
 202      -terminal is called a \fIjob_id\fR. All jobs exist in one of the following
 203      -states: foreground, background or stopped. These terms are defined as follows:
 204      -.RS +4
 205      -.TP
 206      -1.
 207      -A job in the \fBforeground\fR has read and write access to the controlling
 208      -terminal.
 209      -.RE
 210      -.RS +4
 211      -.TP
 212      -2.
 213      -A job in the \fBbackground\fR is denied read access and has conditional
 214      -write access to the controlling terminal (see \fBstty\fR(1))
 215      -.RE
 216      -.RS +4
 217      -.TP
 218      -3.
 219      -A \fBstopped\fR job is a job that has been placed in a suspended state,
 220      -usually as a result of a \fBSIGTSTP\fR signal (see \fBsignal.h\fR(3HEAD)).
 221      -.RE
 222      -.sp
 223      -.LP
 224      -Every job that the shell starts is assigned a positive integer, called a
 225      -\fIjob_id number\fR which is tracked by the shell and are used as an identifier
 226      -to indicate a specific job. Additionally, the shell keeps track of the
 227      -\fBcurrent\fR and \fBprevious\fR jobs. The \fBcurrent job\fR is the most recent
 228      -job to be started or restarted. The \fBprevious job\fR is the first non-current
 229      -job.
 230      -.sp
 231      -.LP
 232      -The acceptable syntax for a Job Identifier is of the form:
 233      -.sp
 234      -.LP
 235      -\fB%\fR\fIjob_id\fR
 236      -.sp
 237      -.LP
 238      -where \fIjob_id\fR can be specified in any of the following formats:
 239      -.sp
 240      -.ne 2
 241      -.na
 242      -\fB\fB%\fR or \fB+\fR\fR
 243      -.ad
 244      -.RS 13n
 245      -for the current job
 246      -.RE
 247      -
 248      -.sp
 249      -.ne 2
 250      -.na
 251      -\fB\fB\(mi\fR\fR
 252      -.ad
 253      -.RS 13n
 254      -for the previous job
 255      -.RE
 256      -
 257      -.sp
 258      -.ne 2
 259      -.na
 260      -\fB\fB?\fR\fI<string>\fR\fR
 261      -.ad
 262      -.RS 13n
 263      -specify the job for which the command line uniquely contains \fIstring\fR.
 264      -.RE
 265      -
 266      -.sp
 267      -.ne 2
 268      -.na
 269      -\fB\fIn\fR\fR
 270      -.ad
 271      -.RS 13n
 272      -for job number \fIn\fR, where \fIn\fR is a job number
 273      -.RE
 274      -
 275      -.sp
 276      -.ne 2
 277      -.na
 278      -\fB\fIpref\fR\fR
 279      -.ad
 280      -.RS 13n
 281      -where \fIpref\fR is a unique prefix of the command name (for example, if the
 282      -command \fBls \(mil name\fR were running in the background, it could be
 283      -referred to as \fB%ls\fR); \fIpref\fR cannot contain blanks unless it is
 284      -quoted.
 285      -.RE
 286      -
 287      -.sp
 288      -.LP
 289      -When Job Control is enabled, \fBfg\fR resumes the execution of a stopped job in
 290      -the foreground, also moves an executing background job into the foreground. If
 291      -\fB%\fR\fIjob_id\fR is omitted the current job is assumed.
 292      -.sp
 293      -.LP
 294      -When Job Control is enabled, \fBbg\fR resumes the execution of a stopped job in
 295      -the background. If \fB%\fR\fIjob_id\fR is omitted the current job is assumed.
 296      -.sp
 297      -.LP
 298      -\fBstop\fR stops the execution of a background job(s) by using its
 299      -\fIjob_id\fR, or of any process by using its \fIpid\fR; see \fBps\fR(1).
 300  100  .SS "csh"
 301      -.sp
 302      -.LP
 303  101  The C shell built-in, \fBjobs\fR, without an argument, lists the active jobs
 304  102  under job control.
 305  103  .sp
 306  104  .ne 2
 307  105  .na
 308  106  \fB\fB-l\fR\fR
 309  107  .ad
 310  108  .RS 6n
 311  109  List process \fBID\fRs, in addition to the normal information.
 312  110  .RE
↓ open down ↓ 76 lines elided ↑ open up ↑
 389  187  .LP
 390  188  \fBbg\fR runs the current or specified jobs in the background.
 391  189  .sp
 392  190  .LP
 393  191  \fBstop\fR stops the execution of a background job(s) by using its
 394  192  \fIjob_id\fR, or of any process by using its \fIpid\fR; see \fBps\fR(1).
 395  193  .sp
 396  194  .LP
 397  195  \fBnotify\fR notifies the user asynchronously when the status of the current
 398  196  job or specified jobs changes.
 399      -.SS "ksh"
 400      -.sp
 401      -.LP
 402      -\fBjobs\fR displays the status of the jobs that were started in the current
 403      -shell environment. When \fBjobs\fR reports the termination status of a job, the
 404      -shell removes its process \fBID\fR from the list of those known in the current
 405      -shell execution environment.
 406      -.sp
 407      -.LP
 408      -\fIjob_id\fR specifies the jobs for which the status is to be displayed. If no
 409      -\fIjob_id\fR is specified, the status information for all jobs are displayed.
 410      -.sp
 411      -.LP
 412      -The following options modify or enhance the output of \fBjobs\fR:
 413      -.sp
 414      -.ne 2
 415      -.na
 416      -\fB\fB-l\fR\fR
 417      -.ad
 418      -.RS 6n
 419      -(The letter ell.) Provides more information about each job listed. This
 420      -information includes the job number, current job, process group \fBID\fR, state
 421      -and the command that formed the job.
 422      -.RE
 423      -
 424      -.sp
 425      -.ne 2
 426      -.na
 427      -\fB\fB-n\fR\fR
 428      -.ad
 429      -.RS 6n
 430      -Displays only jobs that have stopped or exited since last notified.
 431      -.RE
 432      -
 433      -.sp
 434      -.ne 2
 435      -.na
 436      -\fB\fB-p\fR\fR
 437      -.ad
 438      -.RS 6n
 439      -Displays only the process \fBID\fRs for the process group leaders of the
 440      -selected jobs.
 441      -.RE
 442      -
 443      -.sp
 444      -.LP
 445      -By default, \fBjobs\fR displays the status of all the stopped jobs, running
 446      -background jobs, and all jobs whose status has changed and have not been
 447      -reported by the shell.
 448      -.sp
 449      -.LP
 450      -If the \fBmonitor\fR option of the \fBset\fR command is turned on, an
 451      -interactive shell associates a \fBjob\fR with each pipeline. It keeps a table
 452      -of current jobs, printed by the \fBjobs\fR command, and assigns them small
 453      -integer numbers. When a job is started asynchronously with \fB&\fR, the shell
 454      -prints a line which looks like:
 455      -.sp
 456      -.LP
 457      -\fB[1]\fR \fB1234\fR
 458      -.sp
 459      -.LP
 460      -indicating that the job, which was started asynchronously, was job number
 461      -\fB1\fR and had one (top-level) process, whose process id was \fB1234\fR.
 462      -.sp
 463      -.LP
 464      -If you are running a job and wish to do something else you can hit the key ^Z
 465      -(Control-Z) which sends a \fBSTOP\fR signal to the current job. The shell then
 466      -normally indicates that the job has been "\fBStopped\fR" (see \fBOUTPUT\fR
 467      -below), and print another prompt. You can then manipulate the state of this
 468      -job, putting it in the background with the \fBbg\fR command, or run some other
 469      -commands and then eventually bring the job back into the foreground with the
 470      -foreground command \fBfg\fR. A ^Z takes effect immediately and is like an
 471      -interrupt, in that pending output and unread input are discarded when it is
 472      -typed.
 473      -.sp
 474      -.LP
 475      -There are several ways to refer to jobs in the shell. A job can be referred to
 476      -by the process id of any process of the job or by one of the following:
 477      -.sp
 478      -.ne 2
 479      -.na
 480      -\fB\fB%\fR\fInumber\fR\fR
 481      -.ad
 482      -.RS 12n
 483      -The job with the specified number.
 484      -.RE
 485      -
 486      -.sp
 487      -.ne 2
 488      -.na
 489      -\fB\fB%\fR\fIstring\fR\fR
 490      -.ad
 491      -.RS 12n
 492      -Any job whose command line begins with \fIstring\fR; works only in the
 493      -interactive mode when the history file is active.
 494      -.RE
 495      -
 496      -.sp
 497      -.ne 2
 498      -.na
 499      -\fB\fB%?\fR\fIstring\fR\fR
 500      -.ad
 501      -.RS 12n
 502      -Any job whose command line contains \fIstring\fR; works only in the interactive
 503      -mode when the history file is active.
 504      -.RE
 505      -
 506      -.sp
 507      -.ne 2
 508      -.na
 509      -\fB\fB%%\fR\fR
 510      -.ad
 511      -.RS 12n
 512      -Current job.
 513      -.RE
 514      -
 515      -.sp
 516      -.ne 2
 517      -.na
 518      -\fB\fB%+\fR\fR
 519      -.ad
 520      -.RS 12n
 521      -Equivalent to \fB%%\fR.
 522      -.RE
 523      -
 524      -.sp
 525      -.ne 2
 526      -.na
 527      -\fB\fB%\(mi\fR\fR
 528      -.ad
 529      -.RS 12n
 530      -Previous job.
 531      -.RE
 532      -
 533      -.sp
 534      -.LP
 535      -The shell learns immediately whenever a process changes state. It normally
 536      -informs you whenever a job becomes blocked so that no further progress is
 537      -possible, but only just before it prints a prompt. This is done so that it does
 538      -not otherwise disturb your work. When the monitor mode is on, each background
 539      -job that completes triggers any trap set for \fBCHLD\fR. When you try to leave
 540      -the shell while jobs are running or stopped, you are warned that `You have
 541      -stopped (running) jobs.' You can use the \fBjobs\fR command to see what they
 542      -are. If you do this or immediately try to exit again, the shell does not warn
 543      -you a second time, and the stopped jobs are terminated.
 544      -.sp
 545      -.LP
 546      -\fBfg\fR moves a background job from the current environment into the
 547      -foreground. Using \fBfg\fR to place a job in the foreground removes its process
 548      -\fBID\fR from the list of those known in the current shell execution
 549      -environment. The \fBfg\fR command is available only on systems that support job
 550      -control. If \fIjob_id\fR is not specified, the current job is brought into the
 551      -foreground.
 552      -.sp
 553      -.LP
 554      -\fBbg\fR resumes suspended jobs from the current environment by running them as
 555      -background jobs. If the job specified by \fIjob_id\fR is already a running
 556      -background job, \fBbg\fR has no effect and exits successfully. Using \fBbg\fR
 557      -to place a job into the background causes its process \fBID\fR to become `known
 558      -in the current shell execution environment, as if it had been started as an
 559      -asynchronous list. The \fBbg\fR command is available only on systems that
 560      -support job control. If \fIjob_id\fR is not specified, the current job is
 561      -placed in the background.
 562      -.sp
 563      -.LP
 564      -\fBstop\fR stops the execution of a background job(s) by using its
 565      -\fIjob_id\fR, or of any process by using its \fIpid\fR. See \fBps\fR(1).
 566  197  .SS "ksh93"
 567      -.sp
 568      -.LP
 569  198  \fBjobs\fR displays information about specified jobs that were started by the
 570  199  current shell environment on standard output. The information contains the job
 571  200  number enclosed in \fB[...]\fR, the status, and the command line that started
 572  201  the job.
 573  202  .sp
 574  203  .LP
 575  204  If \fIjob_id\fR is omitted, \fBjobs\fR displays the status of all stopped jobs,
 576  205  background jobs, and all jobs whose status has changed since last reported by
 577  206  the shell.
 578  207  .sp
↓ open down ↓ 106 lines elided ↑ open up ↑
 685  314  .LP
 686  315  \fBfg\fR places the specified jobs into the foreground in sequence and sends a
 687  316  \fBCONT\fR signal to start each running. If \fIjob_id\fR is omitted, the most
 688  317  recently started or stopped background job is moved to the foreground.
 689  318  .sp
 690  319  .LP
 691  320  \fBbg\fR places the specified jobs into the background and sends a \fBCONT\fR
 692  321  signal to start them running. If \fIjob_id\fR is omitted, the most recently
 693  322  started or stopped background job is resumed or continued in the background.
 694  323  .SH OUTPUT
 695      -.sp
 696      -.LP
 697  324  If the \fB-p\fR option is specified, the output consists of one line for each
 698  325  process \fBID\fR:
 699  326  .sp
 700  327  .LP
 701  328  \fB"%d\en",\fR \fI"process ID"\fR
 702  329  .sp
 703  330  .LP
 704  331  Otherwise, if the \fB-l\fR option is not specified, the output is a series of
 705  332  lines of the form:
 706  333  .sp
↓ open down ↓ 127 lines elided ↑ open up ↑
 834  461  The associated command that was specified to the shell.
 835  462  .RE
 836  463  
 837  464  .sp
 838  465  .LP
 839  466  If the \fB-l\fR option is specified, a field containing the process group
 840  467  \fBID\fR is inserted before the \fBstate\fR field. Also, more processes in a
 841  468  process group can be output on separate lines, using only the process \fBID\fR
 842  469  and \fBcommand\fR fields.
 843  470  .SH ENVIRONMENT VARIABLES
 844      -.sp
 845      -.LP
 846  471  See \fBenviron\fR(5) for descriptions of the following environment variables
 847  472  that affect the execution of \fBjobs\fR, \fBfg\fR, and \fBbg\fR: \fBLANG\fR,
 848  473  \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 849  474  .SH EXIT STATUS
 850      -.SS "sh, csh, ksh"
 851      -.sp
 852      -.LP
      475 +.SS "csh"
 853  476  The following exit values are returned for \fBjobs\fR, \fBfg\fR, and \fBbg\fR:
 854  477  .sp
 855  478  .ne 2
 856  479  .na
 857  480  \fB\fB0\fR\fR
 858  481  .ad
 859  482  .RS 6n
 860  483  Successful completion.
 861  484  .RE
 862  485  
 863  486  .sp
 864  487  .ne 2
 865  488  .na
 866  489  \fB\fB>0\fR\fR
 867  490  .ad
 868  491  .RS 6n
 869  492  An error occurred.
 870  493  .RE
 871  494  
 872  495  .SS "ksh93"
 873      -.sp
 874      -.LP
 875  496  The following exit values are returned for \fBjobs\fR:
 876  497  .sp
 877  498  .ne 2
 878  499  .na
 879  500  \fB\fB0\fR\fR
 880  501  .ad
 881  502  .RS 6n
 882  503  The information for each job is written to standard output.
 883  504  .RE
 884  505  
↓ open down ↓ 42 lines elided ↑ open up ↑
 927  548  .sp
 928  549  .ne 2
 929  550  .na
 930  551  \fB\fB>0\fR\fR
 931  552  .ad
 932  553  .RS 6n
 933  554  One more jobs does not exist or there are no background jobs.
 934  555  .RE
 935  556  
 936  557  .SH ATTRIBUTES
 937      -.sp
 938      -.LP
 939  558  See \fBattributes\fR(5) for descriptions of the following attributes:
 940      -.SS "csh, sh, ksh"
 941      -.sp
 942      -
 943      -.sp
      559 +.SS "csh"
 944  560  .TS
 945  561  box;
 946  562  c | c
 947  563  l | l .
 948  564  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 949  565  _
 950  566  Interface Stability     Committed
 951  567  _
 952  568  Standard        See \fBstandards\fR(5).
 953  569  .TE
 954  570  
 955  571  .SS "ksh93"
 956      -.sp
 957      -
 958      -.sp
 959  572  .TS
 960  573  box;
 961  574  c | c
 962  575  l | l .
 963  576  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 964  577  _
 965  578  Interface Stability     Uncommitted
 966  579  .TE
 967  580  
 968  581  .SH SEE ALSO
 969      -.sp
 970      -.LP
 971      -\fBcsh\fR(1), \fBkill\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBps\fR(1),
 972      -\fBsh\fR(1), \fBstop\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1),
      582 +\fBcsh\fR(1), \fBkill\fR(1), \fBksh93\fR(1), \fBps\fR(1),
      583 +\fBstop\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1),
 973  584  \fBwait\fR(1), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5), \fBenviron\fR(5),
 974  585  \fBstandards\fR(5)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX