find - search for files in a directory hierarchy.
1 - Simple Search
find
command
.
means it will search all the directory you are in and sub directories.
-name
will look for that name exactly, if a character is different or upper or lower case, it will ignore it.
file.txt
filename
2 - Search ignoring case sensitive
- /home/ will only search this directory recursively (sub directories)
- upper or lower case name
3 - Search Directories
4 - Wildcard Search
- finds all files that have the word file at the beginning, middle or end
5 - Search by File Type
-f
only files with extension odt
, in that case, even without -f
would also find
6 - Search by permission and find all files that have permission 777
7 - Search other than permission finds all files that do not have permission 777
8 - Search for files in empty directories without telling if it is - type d
or - type f
it searches both
-type d
search only directories
-type f
looks for files only
9 - Search for hidden folders
10 - Search by size will find all files larger than 10 MB
You will find all files smaller than 10MB
11 - Search and remove with -exec
Or with xargs
12 - Search by Name Within File
13 - Searches for ACCESSED (atime
) files in the last 24 hours (for more than 3 days, use +3)
14 - Searches for ACCESSED (amin
) files in last 5 minutes
15 - Searches for CREATED (ctime
) files in the last 12 hours
16 - Searches for MODIFIED (mtime
) files in the last 6 hours
17 - Search for Sticky Bit Files with 551
Permission
18 - Search for SUID Files
19 - Search for SGID Files
20 - Search for executable files
or read only
There are more possibilities, you can see them all in the command manual:
Thanks for reading!
find
command
shell
unix
linux
Marcos Oliveira
Software developer