Unix: Ignoring lots of permission denied messages when finding files

Problem


We often (and probably quite correctly) need to make do with Unix accounts that do not have much power. Sometime we want to look for something and we have no idea where it could be so we search from root. This normally give us lots of permission denied messages, and on a large box this means that you need to spool your output and then look through the file to scan through the permission denied messages to find what you are looking for.

Solution

As usual for Unix, I've seen lots of people offering help online and very little of it works. For me, on the Unix boxes I have used, the following works.
find . -iname "xdo.cfg" -print 2>/dev/null

(Where xdo.cfg is the file I was looking for)

Acknowledgement

http://www.cyberciti.biz/faq/bash-find-exclude-all-permission-denied-messages/

Comments