Firstly you tell the system to find something; secondly you tell it where to look; and finally, you tell it what to look for.
You don’t need to specify when you’re looking in your working directory. Also, you can use wildcards as well, in specifying both a directory and a name.
A wildcard is * you can use find file* and it will match with files that have file in the start and if you do *1 and then the file would have 1 at the end .
The username of the owner of a file is specified by the -user flag .
#find all files owned by root
find / -type f -user root
The size of a file -size
Formats to write numbers are :
-n less than n ,+n more than n , n exactly
c is bytes ,k is KiB's and M is MiB's.
#find shell scripts over the size of 10KiB
find / -size +10k "*.sh"
-perm flag is used to specify permisions.either in octal form (777) or in sybmolic like u=r if you specify these perm then the find will return files with those permissions exactly.
you can use - or / to make your search more inclusive.Using the - glag will return files with at least the permissions you specified.This means that -444 mode will match the files readavle by everyone ,even if someone has write or execute permsiions.Using the / prefix will return the files match any of the permisions you have set ; this means that the /666 mode will match files that are readable and writeable by at least one other group
#find all SUID
find / -type f -perm /4000 2>/dev/null