Low Orbit Flux Logo 2 F

Linux How To Bring Job To Foreground

On linux, if you have a job running in the background and you want to bring it to the foreground you can do that with the fg command. This is one of the easier things you learn when starting out with the command line on Linux and Unix.

To bring a job to the foreground first find the job id. You can list jobs and IDs with the jobs command. You can then use the fg command to bring it to the foreground like this:


jobs      
fg 1       

The above will bring the job with ID 1 to the foreground.

If you want to send a currently running job to the background you first stop the job with [CTRL] - Z and then put it in the background with the bg command after checking the job ID.


[CTRL] - z
jobs 
bg 1

You can also put a job in the background using the ampersand when initially run it like this.


bash test.sh&

You can kill a job like this:


kill %1

Linux - Bring Job to Foreground - Video