Tuesday, December 28, 2021

Send running process to background using disown

10:36 AM Posted by Dilli Raj Maharjan No comments


Sometimes we are in hurry and we execute the long-running command in the shell which makes us wait. I still remember that I did it some time and woke up the entire night to keep monitoring the command. Using the command disown we can make the running command run in the background and detach it from the shell so that it won't get killed when we terminate the shell.


  • Execute the process. In the example below I have executed the command sleep for 15 mins(900 seconds).

  • Ctrl + Z to pause the program and get shell prompt back. If Ctrl + Z is not working then execute kill -SIGSTOP PID 

  • Check the process with ps command.

  • Execute command bg to run the process in the background.

  • Execute jobs command to find the jobid of the program

  • Execute command disown -h [jobid]    %1 for first and %2 for a second.

  • Checked if the process is still running.

  • Exit from the terminal

  • Run bash command in the docker container and check the process is running.