Make Linux nohup Command do not Save nohup.out File – Linux Tutorial

By | January 14, 2022

When we are running python script, we may use linux nohup command to save all python print message into a nohup.out file.

Here is the tutorial:

Save All Python Print into a Log File When Running

For example:

sudo nohup python voiceprint_server_9005.py &

It will save all python print message to nohup.out file defautly.

Make Linux nohup Command do not Save nohup.out File - Linux Tutorial

However, nohup.out file may become bigger and bigger. We can make nohup.out do not create nohup.out file and save content.

We can use command below:

sudo nohup python voiceprint_server_9005.py > /dev/null 2>&1 &

This command will make nohup command save print message to a nonexistent file /dev/null.

Finally, we will find nohup.out file does not exist when nohup is run.

Leave a Reply