FG(1POSIX)
π FG(1POSIX) β the POSIX Programmer's Manual, bestie edition π
okay so real quick before we dive in: this page is part of the POSIX Programmer's Manual. Heads up though β the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the actual Linux behavior), or honestly the interface might not even be implemented on Linux at all. π
β¨ NAME β¨
fg β run jobs in the foreground
π SYNOPSIS π
fg [job_id]
π DESCRIPTION π
okay so here's the tea. If job control is enabled (see the description of set -m), the fg utility shall move a background job from the current environment (see Section 2.12, Shell Execution Environment) into the foreground. main character promotion, basically. π
And the way that using fg to place a job into the foreground shall remove its process ID from the list of those ``known in the current shell execution environment'' β see Section 2.9.3.1, Examples. she's out of the group chat, she's on stage now. π«
πΈ OPTIONS πΈ
None. not a single one, bestie. she needs nothing. π
π¦ OPERANDS π¦
The following operand shall be supported:
job_idβ Specify the job to be run as a foreground job. If nojob_idoperand is given, thejob_idfor the job that was most recently suspended, placed in the background, or run as a background job shall be used. (so like, the most recent one, she's the default fave β¨). The format ofjob_idis described in the Base Definitions volume of POSIX.1β2017, Section 3.204, Job Control Job ID.
π STDIN π
Not used. she does not read from stdin, she's not taking questions rn.
π INPUT FILES π
None.
π ENVIRONMENT VARIABLES π
The following environment variables shall affect the execution of fg:
LANGβ Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1β2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLβ If set to a non-empty string value, override the values of all the other internationalization variables. she overrides everybody, no cap. πLC_CTYPEβ Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).LC_MESSAGESβ Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHβ Determine the location of message catalogs for the processing ofLC_MESSAGES.
β ASYNCHRONOUS EVENTS β
Default. nothing fancy, she's lowkey chill about it.
π₯ STDOUT π₯
The fg utility shall write the command line of the job to standard output in the following format:
"%s\n", <command>
π STDERR π
The standard error shall be used only for diagnostic messages. just diagnostics, bestie. that's it.
π§ OUTPUT FILES π§
None.
πΈ EXTENDED DESCRIPTION πΈ
None.
π EXIT STATUS π
The following exit values shall be returned:
0β Successful completion. slay. β¨>0β An error occurred. π
π«Ά CONSEQUENCES OF ERRORS π«Ά
If job control is disabled, the fg utility shall exit with an error and no job shall be placed in the foreground. like, none. not happening. π«
fr fr, the following sections are informative.
π APPLICATION USAGE π
ngl the fg utility does not work as expected when it is operating in its own utility execution environment, because that environment has no applicable jobs to manipulate. See the APPLICATION USAGE section for bg. For this reason, fg is generally implemented as a shell regular built-in. iykyk. π
π¦ EXAMPLES π¦
None.
π RATIONALE π
okay so storytime. The extensions to the shell specified in this volume of POSIX.1β2017 have mostly been based on features provided by the KornShell. The job control features provided by bg, fg, and jobs are also based on the KornShell. The standard developers examined the characteristics of the C shell versions of these utilities and found that differences exist. Despite widespread use of the C shell, the KornShell versions were selected for this volume of POSIX.1β2017 to maintain a degree of uniformity with the rest of the KornShell features selected (such as the very popular command line editing features). iconic decision-making honestly. β
π« FUTURE DIRECTIONS π«
None.
π SEE ALSO π
Section 2.9.3.1, Examples, Section 2.12, Shell Execution Environment, bg, kill, jobs, wait
The Base Definitions volume of POSIX.1β2017, Section 3.204, Job Control Job ID, Chapter 8, Environment Variables
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie π brought to you by the fine folks at IEEE / The Open Group, dated 2017, from FG(1POSIX) β go forth and foreground your jobs, you absolute icon π
β¨
π¦ where this page comes from
- debian bookworm: manpages-posix 2017a-2 Β· Other
- debian trixie: manpages-posix 2017a-2 Β· Other
- ubuntu jammy: manpages-posix 2017a-2 Β· Other
- ubuntu noble: manpages-posix 2017a-2 Β· Other
- ubuntu resolute: manpages-posix 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms