What is nohup?

“nohup” stands for no hangups. “nohup” is not a regular command. But, you will run other commands or scripts with nohup command.

When you execute a command or script, it may run for a second or few and it terminates (finishes). However, when you need to run a long-running jobs (commands or scripts), it might take over your terminal until it finishes. This is where we usually run the process in the background using the “&”. However, if you logout or close the session, the process will most likely die. This is where nohup helps.

When a command or script is executed with nohup, the process continues to run even if the user logs out or closes the session. In other words, the nohup ignores signals 01 (hangup) and 03 (quit). This is what makes the process continue to run even after the user logs out or closes the session.


 nohup [ Command or Script ]

However, nohup commands are generally executed in the background by using “&”.

Here is an example of running “nighly_backups.sh” script using nohup:

 linuxsignal@ubuntua:~$nohup nightly_backups.sh &


By default, the nohup command writes the output to nohup.out file because there is no terminal associated to it.

nohup.out is created in the directly where nohup command is executed. 

Both standard out and standard error are written to this file.

You can override it by redirecting to a desired file, as below.

$ nohup nightly_backups.sh > /home/bkmanager/nbackup.log &