Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 am looking forward to run commands and log their output in a temporary log file to be read later on by different processes.

So, for example: rc.d start ntpd > progress.txt

Returns: ::Daemon scriptntpddoes not exist or is not executable.

I assume, that since it's an error it doesn't get redirected, but, is there a way to force redirect everything to file?

share|improve this question
up vote 6 down vote accepted

You only redirect STDOUT to progress.txt but errors are normally written to STDERR.

To redirect both STDOUT and STDERR to progress.txt try:

rc.d start ntpd &> progress.txt

You'll find many additional information on this topic if you search for .

share|improve this answer
Thanks, &> did the trick. – joltmode Sep 11 '12 at 13:18
&> is not available in all shells (e.g. older ones), so if you are ever in one of those and wonder why &> doesn't work, it is equivalent to the more portable > file 2>&1. – jw013 Sep 11 '12 at 14:37

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.