I have a process originally running in the foreground. I suspended by Ctrl+Z, and then resume its running in the background by bg <jobid>.I wonder how to suspend a process running in the background?How can I bring a background process to foreground?Edit:The process outputs to stderr, so how shall I issue the command fg <jobid> while the process is outputting to the terminal?
How to suspend and bring a background process to foreground
shell;job control;background process
As Tim said, type fg to bring the last process back to foreground.If you have more than one process running in the background, do this:$ jobs[1]   Stopped                 vim[2]-  Stopped                 bash[3]+  Stopped                 vim 23fg %3 to bring the vim 23 process back to foreground.To suspend the process running in the background, use: kill -STOP %job_idThe SIGSTOP signal stops (pauses) a processin essentially the same way Ctrl+Z does.example: kill -STOP %3. sources: How to send signals to processes in Linux and Unixand How to manage background and foreground jobs.