You are not allowed to perform this action
find
GNU find
Cheat sheet
| Effect | Option | Example | |
|---|---|---|---|
| Name | find by name | -name name | find . -name sshd_config find . -name \*.conf |
| find by name (case insensitive) | -iname name | find . -iname \*.jpg find . -iname \*english\* |
|
| find by name (regular expression) | -regex pattern | find . -regex '.*txt' |
|
| Type | find regular files | -type f | find . -type f |
| find directories | -type d | find . -type d |
|
| find symbolic links | -type l | find . -type l |
|
| find named pipes | -type p | find / -type p |
|
| find sockets | -type s | find / -type s |
|
| Size | find by size | -size [+|-]n[k|M|G] | find . -size +2G |
| Time | modified days ago | -mtime [+|-]n | find . -mtime +14 find . -mtime +2 -mtime -7 |
| modified minutes ago | -mmin [+|-]n | find . -mmin -120 |
|
| created days ago | -ctime [+|-]n | find . -ctime +14 find . -ctime +2 -ctime -7 |
|
| created minutes ago | -cmin [+|-]n | find . -cmin -120 |
|
| accessed days ago | -atime [+|-]n | find . -atime +14 find . -atime +2 -atime -7 |
|
| accessed minutes ago | -amin [+|-]n | find . -amin -120 |
|
| Comparison | modified more recently than | -newer file | find . -newer old_file.txt |
| created more recently than | -cnewer file | find . -cnewer old_file.txt |
|
| accessed more recently than | -anewer file | find . -anewer old_file.txt |
|
| Permissions | find by file permissions | -perm mode | find . -perm -o=x |
| find only user-readable files | -readable | find / -readable -name config |
|
| find only user-writable files | -writable | find / -writable -name config |
|
| find only user-executable files | -executable | find / -executable -name config |
|
| find files owned by user | -user user | find /tmp -user alice |
|
-uid n | find . -uid 1001 |
||
| find files owned by group | -group group | find /tmp -group video |
|
-gid n | find . -gid 1001 |
||
| Search depth | descend exactly n levels | -depth n | find / -depth 1 |
| descend into n levels | -maxdepth n | find . -name example -depth 1 |
|
| descend at least n levels | -mindepth n | find / –mindepth 2 –name bin –type d |
|
| don't descend into other file systems | -mount | find / -name test –mount |
|
| follow symbolic links | -L | find -L / -name test |
|
| Hardlinks | search for files that refer to same inode | -samefile file | find / -samefile test.mkv |
| file has n hard links | -links n | find . -links 1 |
|
| Actions | execute command on results | -exec $COMMAND {} + | find . -type d -exec rm {} + |
More examples
| Change UID of files | find . -uid 1000 -exec chown $NEWUSER {} + |
| Change GID of files | find . -gid 1000 -exec chgrp $NEWGROUP {} + |
find.txt · Last modified: by wolfo
