Find command is used to find files that match the criteria of the command -line arguments.
Syntax: find/-option file_name
Ex. find /name ssh.conf
Here, find is a command to fine file, / is a location where to search file, name is a option type and ssh.conf is a name of file for search .
Search file by ID
uid Search for files owned by user ID 1000
Ex. find -uid 1000
gid Search for files owned by group ID 2000
Ex. find -gid 2000
Search files by permission
-perm option is used to search files by file permission
Ex. find/home -perm 764
above command would match any file for which user has read,write,and execute permission and the group has read write permission and others have read-only permission.
Search files by Size find files that match a size specified with the size option,
- k for kilobytes
- M for megabytes
- G for gigabytes
Ex. Search files by size of exactly 0 gigabytes
find -size 10M
Ex. Search files by size more than 10 gigabytes
find -size +10G
How to find files by Time
The -mmin option followed by time in minutes , searches for all files taht had their content changed at exact the given time in the past.
Ex. Find files that had changed their content exactly 120 minutes ago.
Ex. Find files that had changed their content more than 120 minutes ago.
find /-mmin +120
Ex. Find files that had changed their content less than 120 minutes ago.
find/ -mmin -120