Summarize the methods and examples of the commands involved in this course, summarize basic regular expressions and extended regular expressions to display lines ending in bash in the/etc/passwd file
Egrep ' bash$ '/etc/passwd
650) this.width=650; "class=" AlignCenter "title=" 1.png "src=" HTTP://STATIC.MOLLOC.COM/LINUX/IMGS/ZY-2015-08-27/1. PNG "alt=" command "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center; "/>
Displays the two-digit or three-digit number in the/etc/passwd file
Egrep ' \<[[:d igit:]]{2,3}\> '/etc/passwd
650) this.width=650; "class=" AlignCenter "title=" 2.png "src=" HTTP://STATIC.MOLLOC.COM/LINUX/IMGS/ZY-2015-08-27/2. PNG "alt=" command "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center; "/>
Show
netstat -tan
Line ending with ' LISTEN ' followed by 0, one, or more whitespace characters in the command result
Netstat-nat | Egrep ' \<listen[[:blank:]]* '
650) this.width=650; "title=" 3.png "src=" http://static.molloc.com/linux/imgs/ZY-2015-08-27/3.png "alt=" command " style= "border:0px;vertical-align:middle;margin:5px 0px;height:auto;"/>
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
Egrep ' ^ ([[:alnum:]]*\>). *\1$ '/etc/passwd
650) this.width=650; "class=" AlignCenter "title=" 4.png "src=" HTTP://STATIC.MOLLOC.COM/LINUX/IMGS/ZY-2015-08-27/4. PNG "alt=" command "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center; "/>
Displays the default shell and UID for root, CentOS, or User1 users on the current system (please create these users beforehand, if not present)
Egrep ' ^ (centos|user1|root) '/etc/passwd | Cut-d:-f3,7
650) this.width=650; "class=" AlignCenter "title=" 5.png "src=" HTTP://STATIC.MOLLOC.COM/LINUX/IMGS/ZY-2015-08-27/5. PNG "alt=" command "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center; "/>
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
Egrep ' ([[: Alpha:]]|_) +\ (\) '/etc/rc.d/init.d/functions
650) this.width=650; "class=" AlignCenter "title=" 6.png "src=" HTTP://STATIC.MOLLOC.COM/LINUX/IMGS/ZY-2015-08-27/6. PNG "alt=" command "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center; "/>
Use echo to output a path, then egrep to find its path base name, and further use Egrep to remove its directory name
Egrep . ..//todo
Find the number between 1-255 in the ifconfig command execution result
Ifconfig | Egrep ' \< (1?[ 1-9]{1,2}|2[0-5]{2}) \> '
650) this.width=650; "class=" AlignCenter "title=" 8.png "src=" HTTP://STATIC.MOLLOC.COM/LINUX/IMGS/ZY-2015-08-27/8. PNG "alt=" command "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center; "/>
This article is from the "Robot" blog, make sure to keep this source http://molloc.blog.51cto.com/1143037/1689701
Zy-2015-08-27