O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.4. The nohup command

If you are running a process and you don’t think it will be completed by the time you log out for the day, use the nohup command. Nohup will continue processing when you exit your account. Nohup means no hang up.

The general format of the command is:

nohup command & 

3.4.1. Submitting a job using nohup

Any output from your job will be redirected to a file called ‘ nohup.out ’, unless you specify otherwise with

nohup command >myout.file 2>&1 

which sends all output to the file myout.file.

Let’s do an example and test that it actually does continue working after you have logged out. We’ll kick off a log cleanup script called ps1.

							$ nohup ps1 & 
[1] 179 
$ nohup: appending output to `nohup.out`
						

Now exit the shell, log back ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required