The nohup command can allow a long-running process to run to completion even after you log off. By default, processes run on the Linux command line are terminated as soon as you log out of your session. However, if you want to start a long-running process and ensure that it keeps running after you log off, there are a couple ways that you can make this happen. The first is to use the nohup command. Using nohup The nohup (no hangup) command will override the normal hangups (SIGHUP signals) that terminate processes when you log out. For example, if you wanted to run a process with a long-running loop and leave it to complete on its own, you could use a command like this one: % nohup long-loop & [1] 6828 $ nohup: ignoring input and appending output to 'nohup.out' Note that SIGHUP is a signal that is sent to a process when the controlling terminal of the process is closed. Once you use the nohup command in this way, you can log out knowing that it will run to completion on its own. Depending on the process, it is likely to be done the next time you log in. In any case, output that is generates will be added to a file named “nohup.out”. If you want your output to be put into a separate file (e.g., if you need to preserve some earlier nohup.out content), you can specify another output name with a command like this: $ nohup long-loop &> nohup2.out & If the process is still running when you log back in, you should be able to find it in the ps command output. You will not see it using the jobs command. $ ps -ef | grep loop shs 6861 6366 0 13:52 pts/4 00:00:00 /bin/bash ./long-loop If the process is completed before you log back in, looks for its output in the nohup.out file. Leaving a process to run on its own after it has already started You can leave a process running on its own even after it has already started running. To do this: Type Ctrl+Z to pause the program and get back to the shell Use the bg command to move the process to run in the background Use the disown -h command (i.e., disown -h %1) where %1 is the job number to disassociate it with your current shell NOTE: You can also find your job number with the jobs command. $ big-loop ^Z [1]+ Stopped big-loop $ bg [1]+ big-loop & Wrap-up Moving a lengthy process to run in the background can allow you to let it continue when you need to move onto some other task or just go home at the end of a busy day. An earlier post on keeping processes running after you log off is available at this URL: How to keep Linux from hanging up on you Related content how-to Compressing files using the zip command on Linux The zip command lets you compress files to preserve them or back them up, and you can require a password to extract the contents of a zip file. By Sandra Henry-Stocker May 13, 2024 4 mins Linux opinion NSA, FBI warn of email spoofing threat Email spoofing is acknowledged by experts as a very credible threat. By Sandra Henry-Stocker May 13, 2024 3 mins Linux how-to The logic of && and || on Linux These AND and OR equivalents can be used in scripts to determine next actions. By Sandra Henry-Stocker May 02, 2024 4 mins Linux how-to Using the apropos command on Linux By Sandra Henry-Stocker Apr 24, 2024 3 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe