Continue Job in Background after Logout

In order to continue a job after logout, we can use “nohup” command which ignores HUP signal.

$ nohup command

Adding “&” gets the command to run in background.

$ nohup command &

Standard output and error of the command are output to nohup.out file created in the directory where the command is executed. If you want to avoid the file creation, redirect standard error to standard output and standard output to /dev/null.

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

Usually “nohup” is used in this style.

Leave a Reply

Required fields are marked *.

This site uses Akismet to reduce spam. Learn how your comment data is processed.