fg
Processes and system
Usage
fg [%<job>]Brings a background or stopped job back to the terminal; it only works on jobs of this shell, and you name them with a job number like `%1`, not a PID.
Common flags
| Flag | Meaning |
|---|---|
| %1 | Bring job number 1 to the foreground. |
| %% or %+ | The current job, the default when no argument is given. |
| %- | The previous job. |
| %vim | The job whose command line starts with vim. |
Examples
fgBring the most recent background job back to the terminal.
jobs -l && fg %2See the list, then pull job 2 forward.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does fg do?
Brings a background or stopped job back to the terminal; it only works on jobs of this shell, and you name them with a job number like `%1`, not a PID.
Q. How do I type it?
fg [%<job>] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
4 are listed here; the full set is in man fg. This command sits under Processes and system.
Related commands
man page: man fg