Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to get rid off "access denied" messages which fills my find output. I've read man find (maybe not too carefully, hit me) and cannot find anything like

-s/--silent or -q/--quiet command line key.

share|improve this question
add comment

3 Answers

The easiest way would be to redirect find's errors with `2>/dev/null', but that may hide some errors you still might want to see, as chris_l mentioned.

If you want a cleaner solution, you can try something like

find foo/ \( -type d -and -not -executable -prune \) -o -print

which tells find not to descend into directories of which it cannot read the contents.

share|improve this answer
add comment

find ... 2>/dev/null

(Note however, that this will redirect all errors, not just "access denied")

share|improve this answer
add comment
find /path -name "foo" 2>&1 | grep -v denied 

This will get rid of all Permission denied errors. Similarly you may edit the code above depending on the situation

share|improve this answer
add comment

Your Answer

 
discard

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