How to put currently running process to background

You’ve just issued time-consuming command in UNIX/LINUX. Suddenly you need to leave or turn off computer but command must be continued and finished in background. Once you have entered command and you don’t want to interrupt it, please follow instructions below to make it continue running in background

First Method

1. Open new terminal window (or duplicate one currently running)

2. Find out current PID of process which is currently running (in our case it is “ping”)

ps aux | grep ping

Find out PID of current running process

3. Suspend command identified by PID and run it in background

sudo kill -20 12402
sudo kill -18 12402

4. In case you want to finish command manually anytime

sudo kill 12402


Second Method

1. Run some command (in our case ping

2. Press Ctrl + Z to stop (pause) the program and get back to the shell

3. Run command in the background

4. Now you can close terminal window (putty) and  your process will be running in the background

5. Open new terminal window and check that process is still running

ps aux | grep ping


READ ALSO:  How to find out TOP talkers in your network