Find Command
Find Command
Find Command
( find the file in current directory -type d is for dir then directory name)
#find . -iname filename
#find . -type d -iname directoryname
(find those file whose have -perm 0777 permission and -print print all )
#find . -type f -perm 0777 -print
#find . -type f -perm 0644 -print
(find those file whose not have -perm 0777 permission and -print print all )
#find . -type f ! -perm 0777 -print
(find those file whose not have -perm 0644 permission and -print print all )
#find . -type f ! -perm 0644 -print
sticky bit permissions those permission which change by only owner it use to save file
from hackers it denoted by 1 example 1551 .
(find directory which have 777 permission and print -exec execute then command chmod
permission 775 put back commands in arry { } \; then execute)
#find . -type d -perm 777 -print -exec chmod 755 {} \;
( find file in current directory name is test and print and then rename file )
#find . -type d -iname test -print -exec cp {} text \; # { } source in this and destination
( find file in current directory name is start from mas print -exec execute and then remove
file )
#find . -type f -iname "mas*" -print -exec rm -rf { } \;
( mv all file which name is start from mas* to the /tmp/ location )
#mv mas* /tmp/
( find file from temp and type is file and -empty and print )
#find /temp/ -type f -empty -print
( find file which is empty and then print and execute command rm -rf and store source in
arry )
#find . -type f -empty -print -exec rm -rf {} \;
( this line is use to creat list of file from 2 to 4 and then end )
#for i in {2..5}; do touch "test$i"; done
(find those file which is created past 60 min - is use to find past files)
#find . -mmin -60