Linux OPS Practice-August 27, 2015 Course assignments

Source: Internet
Author: User
Tags egrep

1. summarize the use of the commands involved in this course and the relevant examples show:

Chmod,chgrp,umask,chown,grep,egrep

2. summarize basic regular expressions and extended regular Expressions

Format:

grep [OPTIONS] PATTERN [FILE ...] :

Options:

--color=auto: The matching string is highlighted; \ \ can be--color directly as the default color

-V: Display mode does not match rows

-I: Ignore character case

-O: Show only strings that can be matched to a pattern

-Q: Silent mode

-E: Using extended regular expressions

1. Basic regular Expression meta-character

.: Matches any single character

*: Matches any of its preceding characters any time

. *: Denotes any character of any length

[]: Any single character within the specified range

[^]: characters other than the specified character

X\{m,n\}: Indicates that the preceding character X appears at least m times, at most n times

X\{m\}: Indicates exact match m times

Note: In the basic regular expression? To be used, the escape character must be added to the front

^: Beginning of line anchor

$: End of line anchor character

\ (\): Group reference

\1: Represents the contents of the first set of parentheses

\2: Represents the contents of the second set of parentheses;

\w: Equivalent to [0-9a-za-z]

\< \b: The first anchor of the word; the left side of the pattern used to denote the word;

\>, \b: the ending anchor; the right side of the pattern used to represent the word

^$: Blank Line

\?:0 or 1 times

\+:1 or more

The metacharacters of the extended regular expression is basically the same as that of the basic regular expression, and the following are the differences:

\ (\) becomes only used () to denote

\{\} to be represented only with {}

+: Indicates that the character before it matches at least once

|: or meaning; for example a|b means A or b is ok

3. display the lines in the/etc/passwd file that end with bash

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

4. display the two-digit or three-digit number in the/etc/passwd file

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

5. display lines 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/M01/72/5F/wKiom1XhxOCzuKQrAACuJ0RWhoU642.jpg "/>

6. Add User bash, Testbash, basher, and Nologin user (Nologin user's shell is/sbin/nologin), then find out/etc/ A row in the passwd file that has the same user name as its shell name

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/5B/wKioL1XhxvygpgF6AACo3vS6Y-o857.jpg "/>

7. Display the default shell and UID of root, CentOS, or User1 user on the current system (please create these users beforehand, if not present)

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

8, 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

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

9, use echo to output a path, and then egrep find its path base name; Further use Egrep to remove its directory name

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

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

Find the number between 1-255 in the result of the ifconfig command execution

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

This article is from the "Marco -51cto-jy1506401-12" blog, be sure to keep this source http://magedu.blog.51cto.com/4824230/1689636

Linux OPS Practice-August 27, 2015 Course assignments

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.