nohup Explained

The command nohup is used to ensure that a process will run even if it loses contact with the terminal in which it is attached.

The syntax is simple:

/usr/bin/nohup command

Showing how the nohup command works requires the use of two terminals. In the first terminal, a simple sleep command is executed with nohup:

$ nohup sleep 10000
nohup: appending output to `nohup.out'

You might recall that the problem with a process existing in the background is that it gets into trouble when it needs to access the display. To get around this, nohup appends all output to a file in the current directory called nohup.out. This is the meaning of the line following the nohup command in the previous example.

The sleep command is a way of having ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.