Set User ID and Set Group ID are Linux permissions that are applied to executable programs. type f -nouser Locate Programs with SUID/SGID Permissions set To locate files in current directory that are not owned by any user find. find -perm 777įind files with read and write permissions for owner and group find -perm 550 name "*.sh" -type f -exec chmod +x \ Find Files Based On their Permissionsįind any file with group write permission find -perm -g=wįind files writable by the file owner find -perm -u=wįind file which are writable by all (owner, group, world) find -perm -a=wįind files which are writable by both their owner and their group find -perm -g+w,u+w Find Files Based On octal Permissionsįind files with read, write, execute permissions for owner, group and world (777). sh extension in the current directory and make them executable find.
The -exec option enables you to run other commands against all the files returned by your current find term.įor example, to find all files that ends with. To find and process files using find command, use the -exec option. iname file.txt find / -iname file.txt -type f find /etc -iname txt-file -type d Find and Process Files and Directories To perform a case insensitive search using find command, use the -iname option. To search for all files beginning with the keyword php and are empty find / -name "php*" -type f -empty Perform Case Insensitive Search Using Find Command To search for empty directories in the root file system tree find / -type d -empty To search for empty files in the root file system tree find / -type f -empty To search for directories with the keyword php find / -name "php*" -type d Search for Empty Files and Directories Using Find Command For example to search for directory with the name squid. To search for files in multiple directories find /usr /etc /home/user -name file.txt -type f Search for Directories Using Find Command To search for all the files that begins with the keyword foo in the current directory find. txt on the directory / find /r -name "*.txt" -type f To search for all files with the extensions. To explicitly specify that the file you are searching for is a file, use -type f where f specifies that what is being searched for should be a file.