nohup automatically redirects stderr to stdout, but I want to send it to the terminal (it shows progress). How can I do that?

2 Answers 2


Just redirect it. Take this script, for example which prints a line to stderr and one to stdout:

echo stderr >&2
echo stdout

If I now run that with nohup and redirect standard error to a file, it works as expected:

$ nohup a.sh 2>er
$ cat er
nohup: ignoring input and appending output to ‘nohup.out’

Note that it also includes the stderr of nohup itself since you are redirecting output of the nohup. You can do the same with stdout:

nohup a.sh > foo

Basically, nohup only uses nohup.out when you don't redirect output.

To print stderr to the terminal, you can use process redirection to pass stderr through tee:

$ nohup a.sh 2> >(tee)
nohup: ignoring input and appending output to ‘nohup.out’
  • "how to use nohup while still sending stderr to the terminal"
    – IttayD
    Jul 1, 2015 at 8:18
  • @IttayD whops, true. See updated answer.
    – terdon
    Jul 1, 2015 at 8:23
  • this will output to stdout
    – IttayD
    Jul 2, 2015 at 11:46
  • @IttayD yes, that's what you asked for. It prints stderr to the terminal, to stdout.
    – terdon
    Jul 2, 2015 at 11:48

As nohup manual states:

   nohup - run a command immune to hangups, with output to a non-tty

It is used to run a command WITHOUT a tty asociated with it, you can end your session and the command will keep running, thus its output is not attached to a tty therefore not being able to show the output there. nohup creates a file named nohup.out though, you can access that file with tail -f from any terminal and keep whatching the command's output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .