find $HOME
find . -name "*.c"
Lists all files with .c extension. Path from current directory.
Probably the most common search condition used.
Note quotes required when using filename wild-card to avoid premature expansion.
[bcwkMG] - scalar multipliers.
find . -perm 0753 # (not suid,guid or sticky), u=rwx, g=rx, o=x
find . -perm u=x,g=w # lists files where only executable for user and writable for group. All other permissions off.
For broader scope, prefix with minus.
find . -perm -0753 # match as long as user has all permissions, group has at least readable and executable permission and other has at least executable permissions.
find . -perm -g=w # lists files that at least have group = write.
To do a type of or where at least one of the user types is on, use forward slash.
find . -perm /ugo+w # lists files where write is on for any of the user types, user(owner), group, other. Just one or all or any combination.
find . -perm -444 -perm /222 ! -perm /111
find . -perm -a+r -perm /a+w ! -perm /a+x # finds files in which every one has read, at least one user-type has write, and nobody has executable (note the ! - NOT )
find . \! -name "backups" -a \! -name "evals" -print
find . \! \( -name backups -o -name evals \) -print
These 2 are the same.
These will print every files except files named backups or evals. This is not the same as -prune which will be covered under actions.
Because both ! and () are shell expressions, backslash is required to pass them unprocessed to the find command.
There are several other test conditions. See man find The man page on find is one of the better man pages on the system. It includes a whole section of examples.