Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I frequently use the program nohup so that my processes are immune to hangups. So if I want to make the program program immune to hangups, I use the command

nohup program &

where & puts the process in the background.

When starting, nohup gives me the message:

nohup: appending output to `nohup.out'

Is there any way to send the output to a file other than nohup.out? Often I want to run many processes in the same directory using nohup, but if I do this, all the output gets lumped together in a single nohup.out file.

The manual page (for example, here) does not seem to have an option for specifying the log file. Can you please confirm this? Also, do you have any thoughts of how I can work around this problem?

share|improve this question
A year late, but a good comprehensive answer was given here: stackoverflow.com/questions/4549489/… – Rahul Jha Oct 6 '14 at 16:37
up vote 42 down vote accepted

GNU coreutils nohup man page indicates that you can use normal redirection:

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'.

Edit: I didn't read your link at first; you may have a different version of nohup, although this section suggests that you can still use normal redirection:

 nohup.out          The output file of the nohup execution if
                    standard  output is a terminal and if the
                    current directory is writable.

You can redirect standard output and standard error to the same file or to different files:

nohup myprogram >myprogram.out 2>myprogram.err
nohup myprogram >myprogram.out 2>&1
share|improve this answer
To answer specifically: use nohup program > program.out & to write the output to program.out instead of nohup.out – Jim Paris Aug 20 '12 at 20:38
And this isn't specific to GNU utilities, the behavior is specified by POSIX. – Gilles Aug 20 '12 at 22:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.