Home How to How to put currently running process to background

How to put currently running process to background

by admin

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 8.8.8.8”)

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 8.8.8.8)

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:  Build own OpenVPN server by using raspberry Pi (Part1/2)

You may also like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept

Privacy & Cookies Policy