Runs jobs in the foreground.
fg [JobID]
If job control is enabled (see "Job Control in the Korn Shell" in AIX 5L Version 5.2 System User's Guide: Operating System and Devices), the fg command moves a background job in the current environment into the foreground. Use the JobID parameter to indicate a specific job to be run in the foreground. If this parameter is not supplied, the fg command uses the job most recently suspended, placed in the background, or run as a background job.
The JobID parameter can be a process ID number, or you can use one of the following symbol combinations:
Using the fg command to place a job into the foreground removes the job's process ID from the list of those known by the current shell environment.
The /usr/bin/fg command does not work when operating in its own command execution environment, because that environment does not have applicable jobs to manipulate. For this reason, the fg command is implemented as a Korn shell or POSIX shell regular built-in command.
The following exit values are returned:
0 | Successful completion. |
>0 | An error occurred. |
If job control is disabled, the fg command exits with an error, and no job is placed in the foreground.
If the output of the job -l command shows the following job running in the background:
[1] + 16477RunningSleep 100 &
use the process ID to run the sleep 100 & command in the foreground by entering:
fg 16477
The screen displays:
sleep
/usr/bin/ksh | Contains the Korn shell fg built-in command. |
/usr/bin/fg | Contains the fg command. |
The bg command, csh command, jobs command, kill command, wait command.
Job Control in the Korn Shell in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.