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:ottturi.comfind / -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.