how to bring a background job to foreground

Solution 1:

Did you use Ctrl+Z, SIGTSTP or SIGSTOP to send it to the background? If so, you can bring it back to the foreground with the command

 fg

To get a list of all the stopped jobs and background jobs, use

jobs

Solution 2:

If you have a list of backgrounded jobs (as seen with the 'jobs' command), you can pick a particular one with

fg %number

where number is the job number.

e.g.

jobs

[1]    suspended  top
[2]  - suspended  top
[3]  + suspended  top

fg %2