I'm trying to save the errors when I do a chmod to a file. I am running the command:

chmod -R 766 * > chmod-errors.txt

But that does not work. I also tried

chmod -R 766 * | cat > chmod-errors.txt

What am I doing wrong?

link|improve this question

80% accept rate
feedback

1 Answer

up vote 5 down vote accepted

You are redirecting the standard output of the command, not the error output. You need to redirect the error output to the file.

chmod -R 766 * 2> chmod-errors.txt
link|improve this answer
+1 Simple, clean and...right! :D – dag729 Jun 29 '10 at 22:52
1  
mywiki.wooledge.org/BashFAQ/055 For more reference material and a detailed explanation. – Nitrodist Jun 29 '10 at 22:56
Thanks @honk, worked great. And thanks @Nitrodist for the background info! I appreciate it VERY much! – artlung Jun 29 '10 at 23:02
feedback

Your Answer

 
or
required, but never shown

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