Monday, 1 April 2013

UNIX "find" command: how to avoid "permission denied" error messages?

Sometimes, when we use "find" UNIX command to locate a file, by its name for example, we are getting a lot of  "permission denied" messages, and it's very hard to analyze the output. This is true especially when we search starting with "/", meaning that we will look through all the directories on the box.

A quick fix is to redirect these messages to to /dev/null and hence getting a clean and readable output, as below:


[host1]/ >find . -type f -name "my_file"  2>/dev/null
./usr/florin/Test_Dir/my_file

No comments:

Post a Comment