Permission-related commands and regular expressions
Command chmod
Command format:
chmod [OPTION] ... Mode[,mode] ... FILE ...
chmod [OPTION] ... Octal-mode FILE ...
chmod [OPTION] ...--reference=rfile FILE ...
Role:
Changing the properties of a file
Common parameters:
There are generally three types of file permissions:
U:owner owner
Group of the genus G:group
O:other Other
A:all All
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/70/wKiom1Xj4bXh7XJSAABlJBLKMIE839.jpg "title=" 1.png " alt= "Wkiom1xj4bxh7xjsaabljblkmie839.jpg"/>
=mode: =rx;=x
Ug=rx
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/70/wKiom1Xj4yHgJoejAANHRoSGRPk654.jpg "title=" 1.png " alt= "Wkiom1xj4yhgjoejaanhrosgrpk654.jpg"/>
"+|-" mode
U+r u+x
Command grep
Command format:
grep [OPTIONS] PATTERN [FILE ...]
grep [OPTIONS] [-E PATTERN |-f file] [FILE ...]
Role:
Text Search tool to search the target text line by row according to the user-specified "mode", printing the matching line
Mode:
Filter conditions written by metacharacters and text characters of regular expressions:
Metacharacters: The character does not represent its literal meaning, it is used to denote the function of the wildcard or control;
Regular expressions are divided into two categories:
Basic Regular Expressions
Extending regular Expressions
grep [OPTIONS] PATTERN [FILE ...]
Options:
--color=auto highlighting the matched string
-V Displays the rows that the pattern does not match
-I ignore character case
-O displays only the string lines that are matched by the pattern
-e using extended regular expressions
Metacharacters
.: Matches any single character
"": matches a single character in any range
"^": matches a single character outside any range
Character Set:
" ": Lower: "" Lowercase letter "": Upper : "" Uppercase letters
"": Alpha: "" "all uppercase and lowercase" ": alnum:" "Numbers plus letters
"": Digit: "" Number "": Space: "" Space "": punct: "" Symbol
Number:
*: Representative Secondary
\? : 0 or 1 times
\ +: More than 1 times
\{m\}: precise M-times
\{m,n\}: At least m times up to N times
. *: Any length character
Position:
^: Beginning $: Line end \<,\b: \>,\b: Ending
Group:
\(\)
Extending regular Expressions
Character Matching
.: Matches any single character
"": matches a single character in any range
"^": matches a single character outside any range
Number of Matches
*: Representative Secondary
? : 0 or 1 times
+: More than 1 times
{m}: precisely M-Times
{M,n}: At least m times up to N times
Position:
^: Beginning $: Line end \<,\b: \>,\b: Ending
Group:
()
Or:
A|b
Practice:
Show lines ending in bash in the etc/passwd file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/6D/wKioL1Xj7YjDNoSIAAG8aIjREtU383.jpg "title=" 1.png " alt= "Wkiol1xj7yjdnosiaag8aijretu383.jpg"/>
Displays the two-digit or three-digit number in the/etc/passwd file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/71/wKiom1Xj6_XSKHvMAAMAQ4aoVdA500.jpg "title=" 1.png " alt= "Wkiom1xj6_xskhvmaamaq4aovda500.jpg"/>
Displays lines that end with ' LISTEN ' followed by 0, one, or more whitespace characters in the ' Netstat-tan ' command result
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/6D/wKioL1Xj7vnjdnENAADQedx6dBg416.jpg "title=" 1.png " alt= "Wkiol1xj7vnjdnenaadqedx6dbg416.jpg"/>
Add user bash, Testbash, basher, and Nologin user (Nologin the user's shell is/sbin/nologin), and then find the row in the/etc/passwd file that has the same user name as its shell name
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/71/wKiom1Xj8DfBrjAzAAEAQTQrIXI167.jpg "title=" 1.png " alt= "Wkiom1xj8dfbrjazaaeaqtqrixi167.jpg"/>
Displays the default shell and UID for root, CentOS, or User1 users on the current system (please create these users beforehand, if not present)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/72/wKiom1Xj81-wj3MvAACkPqaq88o930.jpg "title=" 1.png " alt= "Wkiom1xj81-wj3mvaackpqaq88o930.jpg"/>
Find a word in the/etc/rc.d/init.d/functions file (the middle of the word can be underlined) followed by a set of parentheses on the line
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/6F/wKioL1Xj-EqALmmcAAEeUiYIvj4733.jpg "title=" 1.png " alt= "Wkiol1xj-eqalmmcaaeeuiyivj4733.jpg"/>
Use echo to output a path, then egrep to find its path base name, and further use Egrep to remove its directory name
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/73/wKiom1Xj-G_Q33ppAACdfgjcoYY150.jpg "title=" 1.png " alt= "Wkiom1xj-g_q33ppaacdfgjcoyy150.jpg"/>
Find the number between 1-255 in the ifconfig command execution result
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/73/wKiom1Xj-h3QivkTAAGw7I9p_Vs094.jpg "title=" 1.png " alt= "Wkiom1xj-h3qivktaagw7i9p_vs094.jpg"/>
Summary of commands for learning Linux (iii)