Nohup Command UNIX
nohup command execute any shell commands or script without any hung-ups i.e. script will not terminate even after terminal session is closed.
Output of nohup command is to a non-tty.
If standard input is a terminal, redirect it from /dev/null. If standard output is a terminal, append output to ‘nohup.out’ if possible, ‘$HOME/nohup.out’ otherwise. If standard error is a terminal, redirect it to standard output. To save output to FILE, use ‘nohup COMMAND > FILE’.
Following options can be used with the nohup command:
|–help||display this help and exit|
|–version||output version information and exit|
Suppose we want to run the â€˜scritp.shâ€™ script at the backend, we will use nohup as shown below:
$ nohup ./script.sh > log.txt &
If someone wants to check the version of nohup installed on the system:
$ nohup –version
nohup (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.