Here are some examples:
Find all files called assignment
1find -type f -name assignment
Find all directories called homework
1find -type d -name homework
Find and delete files called .DS_Store
1find . -type f -name .DS_Store -exec rm -rf {} \;
Find all folders called cache and set their permissions to 777
1find . -type d -name cache -exec chmod 777 {} \;
find --help
and man find
to read help docs and find out the possibilitiestests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
-readable -writable -executable
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls] -context CONTEXT
-mtime
is for modification time, -ctime
is for creation time, atime
is for access time.-type
are
- f
for regular files
- d
for directory
- l
for symbolic link
- s
for scoket file-type f,d,l