Linux: How to make a foreground process run in background

So you started a process on a remote server. The job is now running in an SSH window and is taking longer than you thought it would. If you close the SSH window, it will kill the process. There is a way by which you can close the SSH window by sending the process to background.

Go to the window where the process is running and type the following commands

> bg

To bring the process back to foreground, use the commands job and fg

Get a list of all the background jobs and then pass the job number to fg

> jobs
> fg [job num]

This works well on Fedora, RedHat and CentOS.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s