fg Command in Linux: Bring Background Processes to Foreground
The fg command in Linux does exactly the opposite of the bg command, bringing the task or background process to the foreground and attached to a terminal.
It also accepts a job number as a parameter.
In this example the find command is again placed in the background with Ctrl-Z and it receives the Job number 1:
$ find / -iname a* 2>/dev/null ^Z[1]+ Parado find / -iname a* 2> /dev/null
To see the programs running in the background, the jobs command can be executed:
$ jobs[1]+ Parado find / -iname a* 2> /dev/null
To bring the Job back to the foreground and connected to the terminal, just run fg. In this example, the Job number was passed as a parameter:
$ fg 1find / -iname a* 2> /dev/null
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.