Linux / Unix Find Command Avoid Permission Denied Messages

Linux / Unix Find Command Avoid Permission Denied Messages

To avoid getting "permission denied" messages when using the find command in Linux or Unix, you can use the -not -perm /u=w option to exclude directories that the current user does not have write permissions for. This will prevent find from trying to search inside those directories, which would otherwise cause the "permission denied" message.

Here is an example of how to use this option:

refer ‮ual:ot‬tturi.com
find / -not -perm /u=w -name "myfile.txt"

This will search for a file named myfile.txt in the entire file system (/), excluding any directories that the current user does not have write permissions for.

Note that this only works for the -perm option of find, and not for other permission-related options such as -user or -group. You may need to use other options or a different approach depending on your specific requirements. Consult the find command's documentation for more information.

Created Time:2017-10-16 14:38:53  Author:lautturi