How to run nohup without generating nohup.out

Last updated on July 16, 2020 by Dan Nanni

Question: When I use nohup, I do not want to have nohup.out file generated. How can I run nohup without nohup.out file?

In Linux, nohup command is typically used to run a long-running job on a remote server. When a job is launched by nohup as its child process, nohup and the job itself are made to ignore SIGHUB signal. As a result, when you launch a process with nohup over a remote SSH session, the process continues to run even after you have logged out or lost the SSH connection.

By default, nohup command redirects all its output from the launched job to nohup.out file. If you want to run nohup without creating nohup.out, you can simply redirect nohup output to /dev/null as follows.

$ nohup some_command > /dev/null 2>&1&

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean