Breadcrumbs 
Learning >> Documentation >> Jobs >> Bringing to foreground
 
Recent News
We're No 1!
We've reached the top! (Of Google!)
[ more ]
Firefox 3 Download Day
Firefox 3 has been officially released and is looking to set a world record for the most downloaded piece of software in 24hrs.
[ more ]
SSL Renewed
SSL cert has been renewed by the admin team.
[ more ]
Bringing to foreground
Bringing to foreground

Once a job has been backgrounded there has to be a way to bring it back into the foreground, or make it active again if its been suspended. This section deals with both. The command is fairly intuitive, bg was used to background, and the foreground is fg. By default this works on the most recent job suspended or backgrounded.

Get the current list of jobs running.

$ jobs
[1]+ Stopped         info
[2]- Stopped         man info

To bring the most recent job which is info,

$ fg

You should now see the info interface which all the general subjects listed. Lets suspend this again for the time being.

Ctrl+Z
[1]+ info &

[1]+ Stopped        info

You should see the above two lines just below where you typed the command fg.

The other method like in backgrounding a job is you can specify the job number to bring that one into the foreground and in most cases make it the active one displaying output to your terminal.

$ fg %2

And you can now see the manual page for the info program, kind of weird really using a help program to explain how to use another help program. In any case its worth noting that for both bg and fg commands you can actually skip the use of the % on most linux platforms. So just typing fg 2 would have had the same effect and is faster than having to reach for the percent symbol.

For now we've seen how to manipulate jobs so the last step is to see the different methods of listing jobs.