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


  27 .\" The contents of this file are subject to the terms of the
  28 .\" Common Development and Distribution License (the "License").
  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Copyright 1989 AT&T
  44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
  45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
  46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved

  47 .\"
  48 .TH JOBS 1 "Nov 2, 2007"
  49 .SH NAME
  50 jobs, fg, bg, stop, notify \- control process execution
  51 .SH SYNOPSIS
  52 .SS "sh"
  53 .LP
  54 .nf
  55 \fBjobs\fR [\fB-p\fR | \fB-l\fR] [% \fIjob_id\fR...]
  56 .fi
  57 
  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 .SS "csh"
  84 .LP
  85 .nf
  86 \fBjobs\fR [\fB-l\fR]
  87 .fi
  88 
  89 .LP
  90 .nf
  91 \fBfg\fR [% \fIjob_id\fR]
  92 .fi
  93 
  94 .LP
  95 .nf
  96 \fBbg\fR [% \fIjob_id\fR]...
  97 .fi
  98 
  99 .LP
 100 .nf
 101 \fBnotify\fR [% \fIjob_id\fR]...
 102 .fi
 103 
 104 .LP
 105 .nf
 106 \fBstop\fR % \fIjob_id\fR...
 107 .fi
 108 
 109 .LP
 110 .nf
 111 \fBstop\fR \fIpid\fR...
 112 .fi
 113 
 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 .SS "ksh93"
 141 .LP
 142 .nf
 143 \fBjobs\fR [\fB-lnp\fR] [\fIjob_id\fR...]
 144 .fi
 145 
 146 .LP
 147 .nf
 148 \fBfg\fR [\fIjob_id\fR...]
 149 .fi
 150 
 151 .LP
 152 .nf
 153 \fBbg\fR [\fIjob_id\fR...]
 154 .fi
 155 
 156 .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 .SS "csh"
 301 .sp
 302 .LP
 303 The C shell built-in, \fBjobs\fR, without an argument, lists the active jobs
 304 under job control.
 305 .sp
 306 .ne 2
 307 .na
 308 \fB\fB-l\fR\fR
 309 .ad
 310 .RS 6n
 311 List process \fBID\fRs, in addition to the normal information.
 312 .RE
 313 
 314 .sp
 315 .LP
 316 The shell associates a numbered \fIjob_id\fR with each command sequence to keep
 317 track of those commands that are running in the background or have been stopped
 318 with \fBTSTP\fR signals (typically Control-Z). When a command or command
 319 sequence (semicolon-separated list) is started in the background using the
 320 \fB&\fR metacharacter, the shell displays a line with the job number in
 321 brackets and a list of associated process numbers:
 322 .sp


 379 
 380 .sp
 381 .LP
 382 A job running in the background stops when it attempts to read from the
 383 terminal. Background jobs can normally produce output, but this can be
 384 suppressed using the `\fBstty tostop\fR' command.
 385 .sp
 386 .LP
 387 \fBfg\fR brings the current or specified \fIjob_id\fR into the foreground.
 388 .sp
 389 .LP
 390 \fBbg\fR runs the current or specified jobs in the background.
 391 .sp
 392 .LP
 393 \fBstop\fR stops the execution of a background job(s) by using its
 394 \fIjob_id\fR, or of any process by using its \fIpid\fR; see \fBps\fR(1).
 395 .sp
 396 .LP
 397 \fBnotify\fR notifies the user asynchronously when the status of the current
 398 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 .SS "ksh93"
 567 .sp
 568 .LP
 569 \fBjobs\fR displays information about specified jobs that were started by the
 570 current shell environment on standard output. The information contains the job
 571 number enclosed in \fB[...]\fR, the status, and the command line that started
 572 the job.
 573 .sp
 574 .LP
 575 If \fIjob_id\fR is omitted, \fBjobs\fR displays the status of all stopped jobs,
 576 background jobs, and all jobs whose status has changed since last reported by
 577 the shell.
 578 .sp
 579 .LP
 580 When \fBjobs\fR reports the termination status of a job, the shell removes the
 581 job from the list of known jobs in the current shell environment.
 582 .sp
 583 .LP
 584 The following options modify or enhances the output of \fBjobs\fR:
 585 .sp
 586 .ne 2
 587 .na
 588 \fB\fB-l\fR\fR


 675 .sp
 676 .ne 2
 677 .na
 678 \fB\fB%-\fR\fR
 679 .ad
 680 .RS 12n
 681 The previous job.
 682 .RE
 683 
 684 .sp
 685 .LP
 686 \fBfg\fR places the specified jobs into the foreground in sequence and sends a
 687 \fBCONT\fR signal to start each running. If \fIjob_id\fR is omitted, the most
 688 recently started or stopped background job is moved to the foreground.
 689 .sp
 690 .LP
 691 \fBbg\fR places the specified jobs into the background and sends a \fBCONT\fR
 692 signal to start them running. If \fIjob_id\fR is omitted, the most recently
 693 started or stopped background job is resumed or continued in the background.
 694 .SH OUTPUT
 695 .sp
 696 .LP
 697 If the \fB-p\fR option is specified, the output consists of one line for each
 698 process \fBID\fR:
 699 .sp
 700 .LP
 701 \fB"%d\en",\fR \fI"process ID"\fR
 702 .sp
 703 .LP
 704 Otherwise, if the \fB-l\fR option is not specified, the output is a series of
 705 lines of the form:
 706 .sp
 707 .LP
 708 \fB"[%d] %c %s %s\en"\fR, \fIjob-number\fR, \fIcurrent\fR, \fIstate\fR,
 709 \fIcommand\fR
 710 .sp
 711 .LP
 712 where the fields are as follows:
 713 .sp
 714 .ne 2
 715 .na
 716 \fB\fIcurrent\fR\fR


 824 formats shown here and indicates the name or description of the signal causing
 825 the termination.
 826 .RE
 827 
 828 .sp
 829 .ne 2
 830 .na
 831 \fB\fIcommand\fR\fR
 832 .ad
 833 .RS 14n
 834 The associated command that was specified to the shell.
 835 .RE
 836 
 837 .sp
 838 .LP
 839 If the \fB-l\fR option is specified, a field containing the process group
 840 \fBID\fR is inserted before the \fBstate\fR field. Also, more processes in a
 841 process group can be output on separate lines, using only the process \fBID\fR
 842 and \fBcommand\fR fields.
 843 .SH ENVIRONMENT VARIABLES
 844 .sp
 845 .LP
 846 See \fBenviron\fR(5) for descriptions of the following environment variables
 847 that affect the execution of \fBjobs\fR, \fBfg\fR, and \fBbg\fR: \fBLANG\fR,
 848 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 849 .SH EXIT STATUS
 850 .SS "sh, csh, ksh"
 851 .sp
 852 .LP
 853 The following exit values are returned for \fBjobs\fR, \fBfg\fR, and \fBbg\fR:
 854 .sp
 855 .ne 2
 856 .na
 857 \fB\fB0\fR\fR
 858 .ad
 859 .RS 6n
 860 Successful completion.
 861 .RE
 862 
 863 .sp
 864 .ne 2
 865 .na
 866 \fB\fB>0\fR\fR
 867 .ad
 868 .RS 6n
 869 An error occurred.
 870 .RE
 871 
 872 .SS "ksh93"
 873 .sp
 874 .LP
 875 The following exit values are returned for \fBjobs\fR:
 876 .sp
 877 .ne 2
 878 .na
 879 \fB\fB0\fR\fR
 880 .ad
 881 .RS 6n
 882 The information for each job is written to standard output.
 883 .RE
 884 
 885 .sp
 886 .ne 2
 887 .na
 888 \fB\fB>0\fR\fR
 889 .ad
 890 .RS 6n
 891 One or more jobs does not exist.
 892 .RE
 893 
 894 .sp


 917 The following exit values are returned for \fBbg\fR:
 918 .sp
 919 .ne 2
 920 .na
 921 \fB\fB0\fR\fR
 922 .ad
 923 .RS 6n
 924 All background jobs are started.
 925 .RE
 926 
 927 .sp
 928 .ne 2
 929 .na
 930 \fB\fB>0\fR\fR
 931 .ad
 932 .RS 6n
 933 One more jobs does not exist or there are no background jobs.
 934 .RE
 935 
 936 .SH ATTRIBUTES
 937 .sp
 938 .LP
 939 See \fBattributes\fR(5) for descriptions of the following attributes:
 940 .SS "csh, sh, ksh"
 941 .sp
 942 
 943 .sp
 944 .TS
 945 box;
 946 c | c
 947 l | l .
 948 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 949 _
 950 Interface Stability     Committed
 951 _
 952 Standard        See \fBstandards\fR(5).
 953 .TE
 954 
 955 .SS "ksh93"
 956 .sp
 957 
 958 .sp
 959 .TS
 960 box;
 961 c | c
 962 l | l .
 963 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 964 _
 965 Interface Stability     Uncommitted
 966 .TE
 967 
 968 .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),
 973 \fBwait\fR(1), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5), \fBenviron\fR(5),
 974 \fBstandards\fR(5)


  27 .\" The contents of this file are subject to the terms of the
  28 .\" Common Development and Distribution License (the "License").
  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Copyright 1989 AT&T
  44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
  45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
  46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
  47 .\" Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
  48 .\"
  49 .TH JOBS 1 "Feb 9, 2021"
  50 .SH NAME
  51 jobs, fg, bg, stop, notify \- control process execution
  52 .SH SYNOPSIS





  53 

























  54 .SS "csh"

  55 .nf
  56 \fBjobs\fR [\fB-l\fR]
  57 .fi
  58 
  59 .LP
  60 .nf
  61 \fBfg\fR [% \fIjob_id\fR]
  62 .fi
  63 
  64 .LP
  65 .nf
  66 \fBbg\fR [% \fIjob_id\fR]...
  67 .fi
  68 
  69 .LP
  70 .nf
  71 \fBnotify\fR [% \fIjob_id\fR]...
  72 .fi
  73 
  74 .LP
  75 .nf
  76 \fBstop\fR % \fIjob_id\fR...
  77 .fi
  78 
  79 .LP
  80 .nf
  81 \fBstop\fR \fIpid\fR...
  82 .fi
  83 


























  84 .SS "ksh93"

  85 .nf
  86 \fBjobs\fR [\fB-lnp\fR] [\fIjob_id\fR...]
  87 .fi
  88 
  89 .LP
  90 .nf
  91 \fBfg\fR [\fIjob_id\fR...]
  92 .fi
  93 
  94 .LP
  95 .nf
  96 \fBbg\fR [\fIjob_id\fR...]
  97 .fi
  98 
  99 .SH DESCRIPTION















































































































































 100 .SS "csh"


 101 The C shell built-in, \fBjobs\fR, without an argument, lists the active jobs
 102 under job control.
 103 .sp
 104 .ne 2
 105 .na
 106 \fB\fB-l\fR\fR
 107 .ad
 108 .RS 6n
 109 List process \fBID\fRs, in addition to the normal information.
 110 .RE
 111 
 112 .sp
 113 .LP
 114 The shell associates a numbered \fIjob_id\fR with each command sequence to keep
 115 track of those commands that are running in the background or have been stopped
 116 with \fBTSTP\fR signals (typically Control-Z). When a command or command
 117 sequence (semicolon-separated list) is started in the background using the
 118 \fB&\fR metacharacter, the shell displays a line with the job number in
 119 brackets and a list of associated process numbers:
 120 .sp


 177 
 178 .sp
 179 .LP
 180 A job running in the background stops when it attempts to read from the
 181 terminal. Background jobs can normally produce output, but this can be
 182 suppressed using the `\fBstty tostop\fR' command.
 183 .sp
 184 .LP
 185 \fBfg\fR brings the current or specified \fIjob_id\fR into the foreground.
 186 .sp
 187 .LP
 188 \fBbg\fR runs the current or specified jobs in the background.
 189 .sp
 190 .LP
 191 \fBstop\fR stops the execution of a background job(s) by using its
 192 \fIjob_id\fR, or of any process by using its \fIpid\fR; see \fBps\fR(1).
 193 .sp
 194 .LP
 195 \fBnotify\fR notifies the user asynchronously when the status of the current
 196 job or specified jobs changes.







































































































































































 197 .SS "ksh93"


 198 \fBjobs\fR displays information about specified jobs that were started by the
 199 current shell environment on standard output. The information contains the job
 200 number enclosed in \fB[...]\fR, the status, and the command line that started
 201 the job.
 202 .sp
 203 .LP
 204 If \fIjob_id\fR is omitted, \fBjobs\fR displays the status of all stopped jobs,
 205 background jobs, and all jobs whose status has changed since last reported by
 206 the shell.
 207 .sp
 208 .LP
 209 When \fBjobs\fR reports the termination status of a job, the shell removes the
 210 job from the list of known jobs in the current shell environment.
 211 .sp
 212 .LP
 213 The following options modify or enhances the output of \fBjobs\fR:
 214 .sp
 215 .ne 2
 216 .na
 217 \fB\fB-l\fR\fR


 304 .sp
 305 .ne 2
 306 .na
 307 \fB\fB%-\fR\fR
 308 .ad
 309 .RS 12n
 310 The previous job.
 311 .RE
 312 
 313 .sp
 314 .LP
 315 \fBfg\fR places the specified jobs into the foreground in sequence and sends a
 316 \fBCONT\fR signal to start each running. If \fIjob_id\fR is omitted, the most
 317 recently started or stopped background job is moved to the foreground.
 318 .sp
 319 .LP
 320 \fBbg\fR places the specified jobs into the background and sends a \fBCONT\fR
 321 signal to start them running. If \fIjob_id\fR is omitted, the most recently
 322 started or stopped background job is resumed or continued in the background.
 323 .SH OUTPUT


 324 If the \fB-p\fR option is specified, the output consists of one line for each
 325 process \fBID\fR:
 326 .sp
 327 .LP
 328 \fB"%d\en",\fR \fI"process ID"\fR
 329 .sp
 330 .LP
 331 Otherwise, if the \fB-l\fR option is not specified, the output is a series of
 332 lines of the form:
 333 .sp
 334 .LP
 335 \fB"[%d] %c %s %s\en"\fR, \fIjob-number\fR, \fIcurrent\fR, \fIstate\fR,
 336 \fIcommand\fR
 337 .sp
 338 .LP
 339 where the fields are as follows:
 340 .sp
 341 .ne 2
 342 .na
 343 \fB\fIcurrent\fR\fR


 451 formats shown here and indicates the name or description of the signal causing
 452 the termination.
 453 .RE
 454 
 455 .sp
 456 .ne 2
 457 .na
 458 \fB\fIcommand\fR\fR
 459 .ad
 460 .RS 14n
 461 The associated command that was specified to the shell.
 462 .RE
 463 
 464 .sp
 465 .LP
 466 If the \fB-l\fR option is specified, a field containing the process group
 467 \fBID\fR is inserted before the \fBstate\fR field. Also, more processes in a
 468 process group can be output on separate lines, using only the process \fBID\fR
 469 and \fBcommand\fR fields.
 470 .SH ENVIRONMENT VARIABLES


 471 See \fBenviron\fR(5) for descriptions of the following environment variables
 472 that affect the execution of \fBjobs\fR, \fBfg\fR, and \fBbg\fR: \fBLANG\fR,
 473 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 474 .SH EXIT STATUS
 475 .SS "csh"


 476 The following exit values are returned for \fBjobs\fR, \fBfg\fR, and \fBbg\fR:
 477 .sp
 478 .ne 2
 479 .na
 480 \fB\fB0\fR\fR
 481 .ad
 482 .RS 6n
 483 Successful completion.
 484 .RE
 485 
 486 .sp
 487 .ne 2
 488 .na
 489 \fB\fB>0\fR\fR
 490 .ad
 491 .RS 6n
 492 An error occurred.
 493 .RE
 494 
 495 .SS "ksh93"


 496 The following exit values are returned for \fBjobs\fR:
 497 .sp
 498 .ne 2
 499 .na
 500 \fB\fB0\fR\fR
 501 .ad
 502 .RS 6n
 503 The information for each job is written to standard output.
 504 .RE
 505 
 506 .sp
 507 .ne 2
 508 .na
 509 \fB\fB>0\fR\fR
 510 .ad
 511 .RS 6n
 512 One or more jobs does not exist.
 513 .RE
 514 
 515 .sp


 538 The following exit values are returned for \fBbg\fR:
 539 .sp
 540 .ne 2
 541 .na
 542 \fB\fB0\fR\fR
 543 .ad
 544 .RS 6n
 545 All background jobs are started.
 546 .RE
 547 
 548 .sp
 549 .ne 2
 550 .na
 551 \fB\fB>0\fR\fR
 552 .ad
 553 .RS 6n
 554 One more jobs does not exist or there are no background jobs.
 555 .RE
 556 
 557 .SH ATTRIBUTES


 558 See \fBattributes\fR(5) for descriptions of the following attributes:
 559 .SS "csh"



 560 .TS
 561 box;
 562 c | c
 563 l | l .
 564 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 565 _
 566 Interface Stability     Committed
 567 _
 568 Standard        See \fBstandards\fR(5).
 569 .TE
 570 
 571 .SS "ksh93"



 572 .TS
 573 box;
 574 c | c
 575 l | l .
 576 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 577 _
 578 Interface Stability     Uncommitted
 579 .TE
 580 
 581 .SH SEE ALSO
 582 \fBcsh\fR(1), \fBkill\fR(1), \fBksh93\fR(1), \fBps\fR(1),
 583 \fBstop\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1),


 584 \fBwait\fR(1), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5), \fBenviron\fR(5),
 585 \fBstandards\fR(5)