The nohup command has the form:
nohup command [ Arg ... ] [ & ]By default the output from the command is appended to the file nohup.out in your current directory.
The system responds by telling you about the process identifier, which is usually a multi-digit numeric. You are also informed that the output from the command will be sent to the file nohup.out.
ls # list directory contents sleep 60 # do nothing for 60 seconds pwd # print working directory who # see who's using the local system
If you wanted you could put all the commands on a single line within the file.Semi-colons must be added to separate multiple commands on a single line.
ls; sleep 60; pwd; who
Run the commands by issuing the command:
nohup sh batchfile &
If execute permission is applied to batchfile using:
chmod u+rx batchfile
you can also execute batchfile using the simplified command:
nohup batchfile &
As in the previous example, output is appended to nohup.out unless redirected from within the file.
To run example b) above but redirect the standard output to a different file, enter:
nohup batchfile > output &
Output from the job is sent to a file called output not to nohup.out.
For more information about nohup type:man nohup