Text-processing tools on Linux systems exercises

Source: Internet
Author: User
Tags egrep

1. Display the line in the/proc/meminfo file that begins with the size S; (Requires: use two ways)

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/81/wKiom1el58zj9UZUAAAl0IrdyZI670.png-wh_500x0-wm_3 -wmp_4-s_675758505.png "style=" Float:none; "title=" Exercise 1 method 1.png "alt=" wkiom1el58zj9uzuaaal0irdyzi670.png-wh_50 "/ >

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/80/wKioL1el58yhi3XWAAAory9XkPU456.png-wh_500x0-wm_3 -wmp_4-s_2816544477.png "style=" Float:none; "title=" Exercise 1 method 2.png "alt=" wkiol1el58yhi3xwaaaory9xkpu456.png-wh_50 "/ >

2. Display lines in the/etc/passwd file that do not end in/bin/bash

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/85/81/wKiom1el59_TNyR7AABGRJ6AcRc772.png-wh_500x0-wm_3 -wmp_4-s_1863157710.png "title=" Exercise 2.png "alt=" Wkiom1el59_tnyr7aabgrj6acrc772.png-wh_50 "/>

3. Show user RPC default shell program

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/80/wKioL1el5-yx_LkHAAALf69TgCU406.png-wh_500x0-wm_3 -wmp_4-s_4263214140.png "title=" Exercise 3.png "alt=" Wkiol1el5-yx_lkhaaalf69tgcu406.png-wh_50 "/>

4. Find out the two-bit or three-digit number in/etc/passwd

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/85/81/wKiom1el5_ry6oNEAABoGD82FKA634.png-wh_500x0-wm_3 -wmp_4-s_2213363522.png "title=" Exercise 4.png "alt=" Wkiom1el5_ry6oneaabogd82fka634.png-wh_50 "/>

5. Display a line in a/etc/grub2.cfg file that starts with at least one whitespace character and that is followed by a non-whitespace character

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/80/wKioL1el6AnR15_lAABJGy3ekUM917.png-wh_500x0-wm_3 -wmp_4-s_3076460475.png "title=" Exercise 5.png "alt=" Wkiol1el6anr15_laabjgy3ekum917.png-wh_50 "/>

6. Find the line ending with ' LISTEN ' followed by 0, 1, or more whitespace characters in the result of the "Netstat-tan" command

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/85/81/wKiom1el6BnhcrWZAAAn-P6AM5s672.png-wh_500x0-wm_3 -wmp_4-s_3909419650.png "title=" Exercise 6.png "alt=" Wkiom1el6bnhcrwzaaan-p6am5s672.png-wh_50 "/>

7. Add user bash, Testbash, basher, and Nologin (whose shell is/sbin/nologin), then find the line in the/etc/passwd file with the name of the shell

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/80/wKioL1el6CaCMg_qAAAXua1d7gg220.png-wh_500x0-wm_3 -wmp_4-s_3670570960.png "style=" Float:none; "title=" Exercises 7.1.png "alt=" wkiol1el6cacmg_qaaaxua1d7gg220.png-wh_50 "/ >

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/85/81/wKiom1el6CfgVsHSAAAjp8tMiNQ538.png-wh_500x0-wm_3 -wmp_4-s_1902470997.png "style=" Float:none; "title=" Exercises 7.2.png "alt=" wkiom1el6cfgvshsaaajp8tminq538.png-wh_50 "/ >



1. Displays the UID and default shell of the current system root, mage, or Wang user

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/85/80/wKioL1el6HHREULXAAAQf6-B9Q0455.png-wh_500x0-wm_3 -wmp_4-s_813801626.png "title=" Exercise 1.png "alt=" Wkiol1el6hhreulxaaaqf6-b9q0455.png-wh_50 "/>

2. Find the line at the beginning of the/etc/rc.d/init.d/functions file that has a word (including an underscore) followed by a parenthesis

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/85/81/wKiom1el6HyDo-LxAABSjRe_xYs606.png-wh_500x0-wm_3 -wmp_4-s_3870909329.png "title=" Exercise 2.png "alt=" Wkiom1el6hydo-lxaabsjre_xys606.png-wh_50 "/>

3. Use Egrep to remove its base name in/etc/rc.d/init.d/functions

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/85/80/wKioL1el6Ibj0gCoAAALzjh6RoY612.png-wh_500x0-wm_3 -wmp_4-s_2105904646.png "title=" Exercise 3.png "alt=" Wkiol1el6ibj0gcoaaalzjh6roy612.png-wh_50 "/>

4. Use Egrep to remove the directory name of the path above

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/81/wKiom1el6JDg1eacAAAMs1ipIgI554.png-wh_500x0-wm_3 -wmp_4-s_1665979255.png "title=" Exercise 4.png "alt=" Wkiom1el6jdg1eacaaams1ipigi554.png-wh_50 "/>

5. Count the number of logons per remote host IP address logged in as root

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/85/80/wKioL1el6JmjVYgdAAALMxHitzg518.png-wh_500x0-wm_3 -wmp_4-s_200716708.png "title=" Exercise 5.png "alt=" Wkiol1el6jmjvygdaaalmxhitzg518.png-wh_50 "/>

6. Use extended regular expressions to represent 0-9, 10-99, 100-199, 200-249, 250-255, respectively

7. Display all IPV4 addresses in ifconfig command results


This article is from the "11798474" blog, please be sure to keep this source http://11808474.blog.51cto.com/11798474/1835141

Text-processing tools on Linux systems exercises

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.