Untitled Document
nohup Command

The nohup ( no hangup) command , when prefixed to a command , permits execution of the process even after the user has logged out . We must use the & with it as well . For more details on nice command Go to Chapter - 9

1. Basic Example -

Run below command , shelll returns the PID this time too and some shell displays this messsage as well . We can now safely log out of the system without aborting the command .

   nohup sort emp.csv &
   545
   Sending output to nohup.out 

2. Example

Run the find command, instructing it to search for any file bigger then 100k. find will continue to search regardless of the user's connection to the terminal, and log results to the file log.txt.

   nohup find -size +100k > log.txt &

3. Running Multiple commands in a piprline

If you run more than one command in a pipeline , you should use the nohup command at the begining of each command in the pipeline

   nohup grep 'Consultant' emp.csv & | nohup sort &
Untitled Document