FG(1P)
π FG(1P) β the POSIX Programmer's Manual girlies' edition π
okay so bestie, welcome to fg from the POSIX Programmer's Manual (yes, the FG(1P) one, that's her full name, she's iconic) β¨
πΈ PROLOG πΈ
bestie real talk for a sec: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for details on Linux behavior, fr), or the interface may not be implemented on Linux at all. no cap. check before you get your hopes up π
π NAME π
fg β run jobs in the foreground π
β¨ SYNOPSIS β¨
fg [job_id]
that's it. that's the whole vibe. one optional little operand and she's ready π«Ά
π¦ DESCRIPTION π¦
okay so. if job control is enabled (peep the description of set -m if you need the deets), the fg utility shall move a background job from the current environment (that's Section 2.12, Shell Execution Environment, iykyk) into the foreground. main character energy, literally pulling your job out of the background and onto center stage π
and here's the lowkey important part: 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 for the receipts.
π OPTIONS π
None.
like. zero. none. she needs no flags, she's perfect as she is π
π OPERANDS π
the following operand shall be supported:
job_idβ specify the job to be run as a foreground job. if you don't hand her ajob_idoperand, she'll use thejob_idfor the job that was most recently suspended, placed in the background, or run as a background job. 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 doesn't want your input bestie, she's got her own plans π
π 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.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.
π STDOUT π
the fg utility shall write the command line of the job to standard output in the following format:
"%s\n", <command>
verbatim, bestie. don't touch the format, that's her signature look β¨
π STDERR π
the standard error shall be used only for diagnostic messages.
π OUTPUT FILES π
None.
πΈ EXTENDED DESCRIPTION πΈ
None.
π₯ EXIT STATUS π₯
the following exit values shall be returned:
0β successful completion. slay π>0β an error occurred. not slay π
π 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. periodt. nothing happens. she just leaves.
the following sections are informative (aka the tea, not the rules β).
π«Ά APPLICATION USAGE π«Ά
okay so this is the important lil heads-up: 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 the same energy.) for this reason, fg is generally implemented as a shell regular built-in. that's the whole reason she lives inside your shell bestie, she needs the gossip (the job list) to function π¦
π EXAMPLES π
None.
π RATIONALE π
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). like, they wanted the whole fit to match, and honestly? valid π
β 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 IEEE/The Open Group, dated 2017, and she ate every single time π β¨ mwah, go foreground those jobs, ily, bye ππ¦π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms