36

in Linux/shell, how can I bring background jobs to foreground and vice versa?

2 Answers 2

49

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
0
25

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .