Basic knowledge of Linux Learning (v)

Source: Internet
Author: User
Tags echo command uppercase letter

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

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/D6/wKiom1fMzN2TL7unAAASBVeKqHA424.png "style=" float: none; "title=" 1.png "alt=" Wkiom1fmzn2tl7unaaasbvekqha424.png "/>

Note: Egrep ' ^ (ROOT|FEDORA|USR1) \> '/etc/passwd to find/etc/passwd users from Root,fedora,user1, exists on the match, does not exist on the skip;

Cut-d:-f1,7 Intercept First and seventh fields

2. Find the line with a set of parentheses after a word in the/etc/rc.d/init.d/functions file, such as: Hello ();

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/D5/wKioL1fMzN3yl8xRAAAnd4yNzfo181.png "style=" float: none; "title=" 2.png "alt=" Wkiol1fmzn3yl8xraaand4ynzfo181.png "/>

Note: Refer to the blog post of Cix123 classmate, feel very detailed, so also write down:

^[_[:alpha:]]+ _: Indicates the beginning of an _ or uppercase letter,

+: Indicates that the preceding character can appear one or more times,

\ (\): Can actually be split into \ (and \), using the \ escape character;

3. Use the echo command to output an absolute path, using grep to remove its base name;

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/D5/wKioL1fMzN3jOD-sAAAejwEWS4Y618.png "style=" float: none; "title=" 3.png "alt=" Wkiol1fmzn3jod-saaaejwews4y618.png "/>

Note: If there is no "/" after Echo "/tmp/log", use Grep-e-O "[^/]+$]

If echo "/tmp/log/" is followed by "/", then use GREP-E-O "[^/]+/?$",/? Indicates that it can occur 1 times or does not appear

Extension: Take out its path name

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/86/D6/wKioL1fM0s3CAxImAAAQJ47-IZg187.png "title=" 3.1. PNG "alt=" Wkiol1fm0s3caximaaaqj47-izg187.png "/>

4, find out the results of the ifconfig command between 1-255 numbers;

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/D6/wKiom1fMzN6TJHoCAAAak4z3iQM237.png "style=" float: none; "title=" 4.png "alt=" Wkiom1fmzn6tjhocaaaak4z3iqm237.png "/>


5, Challenge: Write a mode, can match the reasonable IP address;

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/86/D5/wKioL1fMzN6Cf5BZAAAoUEoF4aI052.png "style=" float: none; "title=" 5.png "alt=" Wkiol1fmzn6cf5bzaaaoueof4ai052.png "/>

6, Challenge: Write a pattern, can match out all the email address;

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/86/D6/wKiom1fMzN6D0Y84AAAdDdbcm08813.png "style=" float: none; "title=" 6.png "alt=" Wkiom1fmzn6d0y84aaadddbcm08813.png "/>

7. Find the main root of the/var directory, and belong to all files or directories of mail;

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/86/D6/wKiom1fMzN7Tqqw2AAA2WvC8fPI164.png "style=" float: none; "title=" 7.1.png "alt=" Wkiom1fmzn7tqqw2aaa2wvc8fpi164.png "/>

Note: Currently in use of the system does not match, so changed a group GDM, but the effect is the same, this can be flexibly handled

8, find the current system does not belong to the main or group of files;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/86/D6/wKiom1fMzN-RiEtuAAAVfa6QSrk960.png "style=" float: none; "title=" 8.0.png "alt=" Wkiom1fmzn-rietuaaavfa6qsrk960.png "/>

Further: Find files or directories that are not owned by the master or group on the current system and have been visited in the last 3 days;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/86/D5/wKioL1fMzN_Aj1ATAAAgbugx2RU293.png "style=" float: none; "title=" 8.1.png "alt=" Wkiol1fmzn_aj1ataaagbugx2ru293.png "/>

Note:-mtime-n +n The file changes time to find the file,-n means that the file change time is now less than n days, + n means that the file change time is now N days ago.

9, find all the users in/etc directory have write permission files;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/86/D6/wKiom1fMzN-QsZzoAAAntje809k144.png "style=" float: none; "title=" 9.png "alt=" Wkiom1fmzn-qszzoaaantje809k144.png "/>

10. Find all files that are larger than 1M in/etc directory and are of normal file type;

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/D5/wKioL1fMzOCiuwxZAAAUtGUlFs4023.png "style=" float: none; "title=" 10.png "alt=" Wkiol1fmzociuwxzaaautgulfs4023.png "/>

Note:-size + file size-type file type

11, find/etc/init.d/directory, all users have execute permission, and other users have write permission files;

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/86/D5/wKioL1fMzOCz7EfdAAAZiR7gcKA124.png "style=" float: none; "title=" 11.png "alt=" Wkiol1fmzocz7efdaaazir7gcka124.png "/>

12. Find files that do not belong to root, bin or hadoop in the/usr directory;

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/D6/wKiom1fMzOCC5SNBAABGZWk2wtU884.png "style=" float: none; "title=" 12.png "alt=" Wkiom1fmzocc5snbaabgzwk2wtu884.png "/>

Note: Hadoop users do not have, business system, do not tamper with it, and the next add a more because the matching file too much turned, too lazy to page;

Simpler way: Find/usr-not \ (-user root-o-user bin-o-user hadoop \)

Here's a pit. I hint: "\ (" and "-user" must be separated by a space, otherwise it will report the following error, then I did not understand, depressed for a long time to find. 650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/D6/wKioL1fM4R_j2ZEIAAAh3cOeU54385.png "title=" 16.png "alt=" Wkiol1fm4r_j2zeiaaah3coeu54385.png "/>

13, to find at least one type of/etc/directory Users do not have write permission files;

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/86/D5/wKioL1fMzOHSBYdUAAAr9S3qHCc739.png "style=" float: none; "title=" 13.png "alt=" Wkiol1fmzohsbyduaaar9s3qhcc739.png "/>

14. Find files whose contents have been modified and not rooted or Hadoop for the last week in/etc directory;

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/D6/wKiom1fMzOHAswVoAAAJgktGodI196.png "style=" float: none; "title=" 14.png "alt=" Wkiom1fmzohaswvoaaajgktgodi196.png "/>

Note: find/etc/-mtime-7 is to find files that have been modified in the last week;-not-user Root-not-user-hadoop is to find files that are not root or Hadoop

Small description of the-A and-O parameters:-a:and, if condition 1 is false then condition 2 is not performed,-o:or if the condition 1 bit true condition 2 is not executed.


650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/86/D6/wKioL1fM2NShoo-bAAAqN4LmyzY749.png "title=" 15.png "alt=" Wkiol1fm2nshoo-baaaqn4lmyzy749.png "/>

Basic knowledge of Linux Learning (v)

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.