Linux Commands: fg
Learn how to use the fg
command in Linux to bring background jobs to the foreground.
When a command is running in the background, indicated by the &
symbol at the end or by using the bg
command, you can use the fg
command to bring it back to the foreground.
To bring the last suspended job to the foreground, simply run:
1 | fg |
You can also specify the job number to bring a specific job to the foreground. Use the jobs
command to get the job numbers:
To resume job #2, run:
1 | fg 2 |
The fg
command is compatible with Linux, macOS, WSL, and any UNIX-based environment.
tags: [“Linux commands”, “fg”, “background jobs”, “foreground”, “jobs”]