how to use find command

find /home -user kaustubh -group cityspidey -mtime 50 -cmin 60 -size 50M -type f -name “*.php” -perm 0755 -exec chmod 644 {} \;
find >> find command
/home >> directory location to search
-user kaustubh >> -user for type user name, kaustubh is user
-group cityspidey >> –group for type group name, cityspidey is group
-mtime 50 >> Last 50 Days Modified Files(-ctime=change time,-atime=Accessed time,-mtime +50 –mtime -100=Last 50-100 Days Modified
-cmin 60 >> Changed Files in Last 1 Hour,-mmin/-amin=modified time /access time)
-size 50M >> find with file size 50MB/-size +50M -size -100M=Size between 50MB – 100MB
-type >> tag for type file or directory name
f >> type directory/link/file use this (d/l/f)
-name/-iname >> type file name tag/type file name with CaseSensitive
*.php >> tyep file/directory name you what search
-perm 0755 >> check with permision
-exec >> execute file
chmod 644 {}\; >> new permision

1 Comment

  1. find file and execute to replace string?
    find ./ -type f -name “*.php” -exec sed -i ‘s/web \one/WebTwo/g’ {} \;
    \ used for not read space. without \ script not run.

Leave a Reply

Your email address will not be published.


*