How to search for files with specific permissions using the 'find' command in Linux?

Published on Aug. 22, 2023, 12:17 p.m.

To search for files with specific permissions using the ‘find’ command in Linux, you can use the ‘-perm’ option followed by the octal representation of the permissions you want to search for.

For example, the following command will find all files in the ‘/path/to/directory’ directory and its subdirectories that have the read, write, and execute permissions set for the owner:

find /path/to/directory -type f -perm /700

You can also search for files with specific permissions using symbolic representation, like this:

find /path/to/directory -type f -perm /u=rwx,g=rx,o=rx

This will find all files that are readable, executable, and writable by the owner, and readable and executable by the group and others.

Note that in the symbolic representation, u stands for user, g stands for group, and o stands for others.

Tags: