bash: Job Control Builtins
1
1 7.2 Job Control Builtins
1 ========================
1
1 'bg'
1 bg [JOBSPEC ...]
1
1 Resume each suspended job JOBSPEC in the background, as if it had
1 been started with '&'. If JOBSPEC is not supplied, the current job
1 is used. The return status is zero unless it is run when job
1 control is not enabled, or, when run with job control enabled, any
1 JOBSPEC was not found or specifies a job that was started without
1 job control.
1
1 'fg'
1 fg [JOBSPEC]
1
1 Resume the job JOBSPEC in the foreground and make it the current
1 job. If JOBSPEC is not supplied, the current job is used. The
1 return status is that of the command placed into the foreground, or
1 non-zero if run when job control is disabled or, when run with job
1 control enabled, JOBSPEC does not specify a valid job or JOBSPEC
1 specifies a job that was started without job control.
1
1 'jobs'
1 jobs [-lnprs] [JOBSPEC]
1 jobs -x COMMAND [ARGUMENTS]
1
1 The first form lists the active jobs. The options have the
1 following meanings:
1
1 '-l'
1 List process IDs in addition to the normal information.
1
1 '-n'
1 Display information only about jobs that have changed status
1 since the user was last notified of their status.
1
1 '-p'
1 List only the process ID of the job's process group leader.
1
1 '-r'
1 Display only running jobs.
1
1 '-s'
1 Display only stopped jobs.
1
1 If JOBSPEC is given, output is restricted to information about that
1 job. If JOBSPEC is not supplied, the status of all jobs is listed.
1
1 If the '-x' option is supplied, 'jobs' replaces any JOBSPEC found
1 in COMMAND or ARGUMENTS with the corresponding process group ID,
1 and executes COMMAND, passing it ARGUMENTs, returning its exit
1 status.
1
1 'kill'
1 kill [-s SIGSPEC] [-n SIGNUM] [-SIGSPEC] JOBSPEC or PID
1 kill -l|-L [EXIT_STATUS]
1
1 Send a signal specified by SIGSPEC or SIGNUM to the process named
1 by job specification JOBSPEC or process ID PID. SIGSPEC is either
1 a case-insensitive signal name such as 'SIGINT' (with or without
1 the 'SIG' prefix) or a signal number; SIGNUM is a signal number.
1 If SIGSPEC and SIGNUM are not present, 'SIGTERM' is used. The '-l'
1 option lists the signal names. If any arguments are supplied when
1 '-l' is given, the names of the signals corresponding to the
1 arguments are listed, and the return status is zero. EXIT_STATUS
1 is a number specifying a signal number or the exit status of a
1 process terminated by a signal. The '-L' option is equivalent to
1 '-l'. The return status is zero if at least one signal was
1 successfully sent, or non-zero if an error occurs or an invalid
1 option is encountered.
1
1 'wait'
1 wait [-n] [JOBSPEC or PID ...]
1
1 Wait until the child process specified by each process ID PID or
1 job specification JOBSPEC exits and return the exit status of the
1 last command waited for. If a job spec is given, all processes in
1 the job are waited for. If no arguments are given, all currently
1 active child processes are waited for, and the return status is
1 zero. If the '-n' option is supplied, 'wait' waits for any job to
1 terminate and returns its exit status. If neither JOBSPEC nor PID
1 specifies an active child process of the shell, the return status
1 is 127.
1
1 'disown'
1 disown [-ar] [-h] [JOBSPEC ... | PID ... ]
1
1 Without options, remove each JOBSPEC from the table of active jobs.
1 If the '-h' option is given, the job is not removed from the table,
1 but is marked so that 'SIGHUP' is not sent to the job if the shell
1 receives a 'SIGHUP'. If JOBSPEC is not present, and neither the
1 '-a' nor the '-r' option is supplied, the current job is used. If
1 no JOBSPEC is supplied, the '-a' option means to remove or mark all
1 jobs; the '-r' option without a JOBSPEC argument restricts
1 operation to running jobs.
1
1 'suspend'
1 suspend [-f]
1
1 Suspend the execution of this shell until it receives a 'SIGCONT'
1 signal. A login shell cannot be suspended; the '-f' option can be
1 used to override this and force the suspension.
1
1 When job control is not active, the 'kill' and 'wait' builtins do not
1 accept JOBSPEC arguments. They must be supplied process IDs.
1