File Lookup:
1.locate: Non-real-time, fuzzy search, search is based on the system-wide file database;
Fast speed
The file database is automatically updated before each shutdown
UpdateDB: Used to manually generate a file database
2.find:
Realtime
Exact search
Support for many search criteria
Traverse all text in the specified directory to complete the lookup
Relatively slow speed
Find Find Path Lookup criteria lookup to future processing operations
Find path: Can omit, default to the current directory
Find criteria: Can be omitted, default to all files under the specified path
Processing operation: Can be omitted, default to display on the screen
Find criteria :
-name ' FILENAME ': exact matching of file masterpieces
Using File name wildcard
*: Any character of any length
?: any single character
[]: Any single choice
-iname ' filename ': file name matching is case insensitive
-regex PATTERN: File name matching based on regular expressions
-user USERNAME: Based on owner Lookup
-group GROUPNAME: Search by Genus Group
-uid UID: Search by UID
-gid GID: Search by GID
-nouser: Finding files that are not owned by the master
-nogroup: Finding files that are not owned by a group
-type F: Normal file
D: Catalogue
C: Character file
B: Block file
L: Hard link file
P:
S: Socket file
-size[+|-]:+ greater than-less than the exact display, for example, 1k is required, then 0-1k are displayed, 10k is required, then the 9-10k display
#k
#M
#G
-mtime
-ctime
-atime
[+|-]#:+5 said it had not been visited for at least five days;-5 for five days, 5 for the fifth day prior to the visit.
-mmin
-cmin
-amin
[+|-]#: Usage Ibid.]
-perm MODE: Exact match
/mode: satisfies the condition by arbitrarily matching in three bits
-mode: File permissions can fully contain this MODE only when the condition is met
Combination condition: When multiple conditions are not specified, the default is-a
-A: With
-O: Or
-not: Non-
Processing Operations :
-print: Display on the screen
-ls: Displays details of each file in a form similar to Ls-l
-ok command {} \;: Execute command, user confirmation not once operation
-exec COMMAND {} \;: Use Find./-perm-006-exec chmod o-w {} \;
Xargs: Usage find./-pwem-006 | Xargs chomod o-w {}
File Search Exercises:
1. Find all files in the/var directory under the master root and belong to the group mail;
Find/var-user Root-group Mail
2. Find files that do not belong to Root,bin or student in the/USR directory;
Find/usr-not-user root-a-not-user bin-a-not-user Student
Find/usr-not \ (-user root-o-user bin-o-user student \)
3. Find files that have been modified in the last week and not belonging to root and student users in/etc directory;
Find/etc-mtime-7-not \ (-user root-o-user student \)
Find/etc-mtime-7-not-user root-a-not-user Student
4, find the current system does not belong to the main or the group and the last 1 days have been visited the files, and the main group are modified to root;
Find/\ (-nouser-o-nogroup \)-a-atime-1-exec chown root:root {} \;
5. Find files larger than 1M in/etc directory and write their filenames to/tmp/etc.largefiles files;
Find/etc-size +1m >>/tmp/etc.largefiles
6, look for all the users in/etc directory do not have permission to write files, display its detailed information;
Find/etc-not-perm/222-ls
Facl:filesystem Access Control List
Save additional access control permissions with file extensions
Setfacl
-M: Set
U:username:perm
G:groupname:perm
D:u:username:perm is used to set the Facl of a directory, and files created under that directory inherit the Facl
D:g:groupname:perm
-X: Cancel
U:username
G:groupname
Getfacl/path/to/file: Viewing the facl of a file or directory
Linux Learning Notes < 11 >--file lookup and file system ACLs