Command

nohup

On Unix-like operating systems, the nohup command executes another command, and instructs the system to continue running it even if the session is disconnected.

$ sudo nohup example-script.sh > log.out &

Nohup is for a single use. Think of a script that will take a long time to run but will still ultimately finish. Maybe there’s a long and complicated task that you run every now and then that takes hours to complete. You don’t want to leave a terminal open or a user logged in, so you use nohup to keep it running in the background. As an added bonus, it’ll automatically log everything for you.

Leave a Reply

Your email address will not be published. Required fields are marked *