• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to close terminal without killing running processes on Linux

Written by Rahul, Updated on February 26, 2020

For example, you are running time-consuming processes and you don’t want that job killed due to terminal closed. To handle this situation, you can simply remove a job from an active job table. So that the job will not be killed when the terminal is closed.

Instructions

Follow the below instruction to detach running jobs from the terminal.

  • 1. Press CTRL + Z to suspend current running process.
    zip -q -r home.zip *
    
    ^Z
    [1]+  Stopped                 zip -q -r home.zip *
    
  • 2. Then run the stopped process in the background by running bg command. It will put the last stopped process to background.
    bg
    
    [1]+ zip -q -r home.zip * &
    
  • 3. Finally, remove the above job from the table of active job. Use [disown -h jobspec] where [jobspec] is the job number of background running job. Like %1 for the first running job.
    disown -h %1
    

    Note: Here 1 is the job ID of background running job. You can also use the “jobs -l” command to find job id.

disown command example

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

1 Comment

  1. Avatar adam Reply
    February 25, 2020 at 1:39 pm

    thanks for the tut Rahul

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • (Solved) apt-add-repository command not found – Ubuntu & Debian 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy