fg [ job_ID ... ]
bg and fg are job control commands built into the Korn shell (see the set -m command on the ksh(C) manual page).
bg resumes suspended jobs and runs them in the background. job_ID specifies the jobs to run in the background (use jobs(C) to find the ID of a job). If job_ID is not specified, bg picks the most recently suspended job.
See jobs(C) for a description of the acceptable formats of job_ID.
bg reports the job_ID and command associated with the job on the standard output in the format:
[ job_ID ] commandfg moves jobs running in the background to run in the foreground. If job_ID is not specified, fg picks the job that was most recently suspended, placed in the background, or run as a background job (using &).
fg reports the command associated with the job on the
standard output in the format:
command
Put the suspended current default job in the background to run:
bg %+
Bring the next current default job to the foreground:
fg %-
Stop the background job whose command begins with the string
``foo'':
kill -s stop %"foo"
Stop the background job that has ID 3:
kill -s stop %3
Resume execution of the job with ID 3 in the background:
bg %3
Define the SUSP character as <Ctrl>z:
stty susp ^Z
Prevent background processes owned by the current shell from writing
to the terminal (this also stops them if they try to output to the
terminal):
stty tostop
Allow background processes owned by the current shell to write
to the terminal:
stty -tostop
You must have enabled job control (using set -m) to use bg and fg.
ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
SCO OpenServer Release 5.0.6 -- 1 August 2000