Use of Find
File Lookup
Find. (current directory)-name
Find. -name "*.txt"-print
Find. -name ' [a-z,a-z,1-100]* '. Txt-print
Find. -name "1.txt"-prune-o-name "*.txt"-print
Directory Lookup
Find. -path "./aa"-prune-o-name "*.txt"-print
Find. -path "./aa"-prune-o-path "./bb"-prune-o-name "*.txt"-print
Permission Lookup
Find. -prem 775-print
Do not look for the file under AAA find. -path "./aa"-prune-0-perm 775-print
Find. -path "./aa"-prune-0-path "./bb"-prune-o-perm 775-print
Find. \ (-path "./aaa"-o-path "./bbb" \)-prune-o-perm 775-print
Find by Type
Soft joins can be understood as shortcuts
Ln-s./aaa/*./ddd
Find.-type l-print
Search by Owner
Find/-user Www-type F-print
Find owner is deleted
Find/-nouser-type F-print
Find/-group apache-type-f-print
Find by Time
It was changed in two days.
Find.-mtime-2-type F-print
It was changed two days ago.
Find.-mtime +2-type F-print
It was changed 10 minutes ago.
Find. -cmin +10-type F-print
Follow the file old and new search
Find a new file than Aa.txt
Find. -newer "Aa.txt"-type f-print
Look for older files than Aa.txt
Find. ! -newer "Aa.txt"-type f-print
Looking for newer than bb.txt older files than Aa.txt
Find. -newer "Aa.txt"! -newer "Bb.txt"-type f-print
Find by File size
In the root directory smaller than 1M
Find/-size +1m-type-print
Files less than 1M
Find/-size-1m-type-print
Execute command
Find. -name "1.txt"-ok rm {} \; New Touch 12a.txt
Find. -name "12a.txt"-exec cp {}{}.bak \;
grep match
Cat 1.txt | grep all--color as soon as all cat 1.txt appears | Grep-w "All" matches a word
Cat-n
Take counter
Cat 1.txt | Grep-v-W "All"
Number of statistics
Cat 1.txt | Grep-c "All"
Number of rows displayed
Grep-n "All"
Show matching files
grep "All" 1.txt 2.txt 3.txt
Grep-l "All" 1.txt 2.txt 3.txt Show only the matching filenames
Grep-i "All" *.txt case-insensitive matching
System service Management
Chkconfig--list Show all services currently running
/etc/inittab
Netstat-antl all n port T TCP protocol L listen Status
Chkconfig--add httpd Increased service
Chkconfig--del httpd Delete
Chkconfig--level 12345
Use of the Find command under Linux