August 27 Jobs

Source: Internet
Author: User
Tags egrep

Twilight Summer, social ますますご sheng のこととおび shen expands on げます. Alter は のご high with をり, thick bootcut Royal Rite Shen expands.

Basic regular

1. Display the line in the/etc/passwd file ending with bash;

cat/etc/passwd | grep color=auto "bash$"

2. Display the two-digit or three-digit number in the/etc/passwd file;

cat/etc/passwd | grep "[10-999]" At first I wrote this, it was wrong

I refer to other people's comments modified as follows, it is useful:

cat/etc/passwd | grep Color=auto CAT/ETC/PASSWDX | grep "\<[1-9][0-9]\{1,2\}\>"

3, display the ' Netstat-tan ' command results with ' LISTEN ' followed by 0, one or more blank characters end of the line;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/5C/wKioL1Xh6ZrQINgZAAEaog_Jczs982.jpg "/>

4, add user Bash,testbash, basher and Nologin user (Nologin the user's shell is/sbin/nologin), and then find the/etc/passwd file in the user name with the shell name of the line;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/60/wKiom1Xh537zHB-bAADUsGAER34649.jpg "/>

Add the user first, the order of the parameters here should be noted

I wrote it first.

cat/etc/passwd | grep "^\ (\<[[:alnum:]]\>*\). *\1$".

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/60/wKiom1Xh536QDUBVAAES2-4dlQU598.jpg "/>

Extended Regular

1. Display the default shell and UID of root, CentOS or User1 user on the current system;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/5C/wKioL1Xh6Zzyl84MAAB5NHddBGM504.jpg "/>

3 users are selected, and filter columns are not filtered

2, 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 line;

Cat/etc/rc.d/init.d/functions |egrep "\<[[:alpha:]]+_? [[: alpha:]]+\>/(/)]

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/5C/wKioL1Xh6Z2g3r3xAACnfcHyleE219.jpg "/>

3, use echo to output a path, and then egrep find its path base name; further: Use Egrep to remove its directory name;

Echo "/home/gh/haha" | Egrep back with a judgment when the last one

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/60/wKiom1Xh54GBs5m1AAA89w1gVU0711.jpg "/>

4. Find out the number between 1-255 in the result of ifconfig command execution;

The number between 1-255 is definitely a separate word, so use prefix \< tail \> to fix and re-screen

I have 2 different cases [0-199] and [200-255]

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/60/wKiom1Xh54Lwby7CAAC_U0Gnins370.jpg "/>

August 27 Jobs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.