fg — Bring a job into the foreground

Format

fg [%job-identifier]

tcsh shell: fg [%job ...]

Description

fg restarts a suspended job or moves a job from the background to the foreground. To identify the job, you give a job-identifier (preceded by %) as given by the jobs command.

If you do not specify job-identifier, fg uses the most recent job to be suspended (with the kill command) or placed in the background (with the bg command). fg is available only if you have enabled job control. See the –m option of set for more information.

In the tcsh shell, fg brings the specified jobs (or, without arguments, the current job) into the foreground, continuing each if it is stopped. job can be '', %, +, –, a number, or a string. See also the run-fg-editor editor command described in tcsh — Invoke a C shell.

Localization

fg uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
>0
No current job

Messages

Possible error messages include:
Not a stopped job
Job was not stopped.

Portability

POSIX.2 User Portability Extension.

Related information

bg, jobs, kill, ps, tcsh