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:
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:
fg 2
The fg
command is compatible with Linux, macOS, WSL, and any UNIX-based environment.