The common face test set of Linux system operation and Maintenance Enterprise (III.)

Source: Internet
Author: User
Tags failover gz file



The common face test set of Linux system operation and Maintenance Enterprise (III.)

01 write an sed command, modify the contents of the/tmp/input.txt file, require: (1) Delete all empty lines, (2) one row, if "11111" is included, insert "AAA" before "11111", insert "after" 11111 " BBB ", for example: Change the line of content 0000111112222 to: 0000aaa11111bbb2222

[Email protected]~]# cat-n/tmp/input.txt

1 000011111222

2

3 000011111222222

4 11111000000222

5

6

7 111111111111122222222222

8 2211111111

9 112222222

10 1122

11

Delete all empty line commands

[Email protected]~]# sed '/^$/d '/tmp/input.txt

000011111222

000011111222222

11111000000222

111111111111122222222222

2211111111

112222222

1122

Inserts the specified character

[Email protected]~]# sed ' s#\ (11111\) #AAA \1bbb#g '/tmp/input.txt

0000aaa11111bbb222

0000aaa11111bbb222222

aaa11111bbb000000222

aaa11111bbbaaa11111bbb11122222222222

22aaa11111bbb111

112222222

1122

Three o'clock in the afternoon every Monday, all files with the suffix *.log below the/tmp/logs directory are synced to the same directory in the backup server 192.168.1.100, and the crontab configuration entry is how to write:

* * 1 rsync-avzp/tmp/logs/*.log [email protected]:/tmp/logs


Find all ordinary files under the/tmp/directory whose names end with "_s1.jpg" and package them in a/tmp/back.tar.gz file if their modification date is within one day

Find/tmp-type f-name ". *_sj.jpg"-mtime 1|xarges tar zcf/tmp/back.tar.gz


04write how to add VirtualHost to Apache to get accesshttp://www.test.comand thehttp://www.test.cn, open the following file in the/var/www/html directory:

<virtualhost *:80>

ServerAdmin [email protected]

DocumentRoot "/var/www/html"

ServerName www.test.com

Serveralias test.cn

Errorlog "Logs/bbs-error_log"

Customlog "Logs/bbs-access_log" common

</VirtualHost>

06 When configuring the MySQL server, configure the auto_increment_increment=3, what is the meaning of the 3 here?

Auto_increment is used for the primary key auto-growth, from 3 onwards, 3 for the self-increment of the starting value

07 Displays the IP address of the native Eth0 network card with one command, no other characters are displayed

Method One:

[Email protected] ~]# ifconfig eth0|grep "inet addr" |awk-f ' [:]+ ' ' {print $4} '

192.168.1.22

Method Two:

[[email protected] ~]# ifconfig eth0|awk-f ' [:]+ ' nr==2 {print $4} '

192.168.1.22

Method Three:

[Email protected] ~]# ifconfig eth0|sed-n ' 2p ' |sed ' s#^.*addr:# #g ' |sed ' s# bc.*$# #g '

192.168.1.22

Method Four:

[[email protected] ~]# ifconfig eth0|sed-n ' 2p ' |sed-r ' s#^.*addr: (. *) Bc.*$#\1#g '

192.168.1.22


08 Please specify how failover works with keepalived

This failover is achieved through the VRRP protocol, the master node will send the heartbeat information at a certain time interval broadcast packet, tell the standby node's own survival status information, when the primary node fails, the standby node in a period of time to receive the broadcast packet, so as to determine the primary node failure, Therefore, it calls its own takeover program to take over the IP resources and services of the primary node, and when the primary node resumes, the standby node will actively release the resources and revert to the state before the takeover to implement the primary and standby failover


Write a Curl command to access the following URL on the specified server 61.135.169.121:http://www.baidu.com/s?wd=test, the access time-out is 20 seconds:

Curl--connect-timeout Http://61.135.169.121/s?wd=test


the netstat command with the other shell command, according to the source IP statistics all to port 80 established status link number, the output is similar (the first column number of connections, the second column IP):

[Email protected]~]# Netstat-an|grep established

TCP 0 139.224.199.85:22 101.47.33.86:51763 established

TCP 0 0 139.224.199.85:45368 106.11.68.13:80 established

[[email protected] ~]# netstat-an|grep established|grep ": 80"

TCP 0 0 139.224.199.85:45368 106.11.68.13:80 established

[[email protected] ~]# netstat-an|grep established|grep ":" |awk ' begin{fs= ' [[: space:]:]+ '}{print $4} '

139.224.199.85

Description: FS is a field delimiter

If you need to organize and sort, the complete command is as follows

[[email protected] ~]# netstat-an|grep established|grep ":" |awk "begin{fs=" [[: Space:]:]+ "}{print $4} ' |sort|uniq-c| Sort-nr



650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/8D/8F/wKioL1ihqa7zXUAyAABspnf9dSI681.jpg-wh_500x0-wm_ 3-wmp_4-s_1214870078.jpg "title=" qrcode_for_gh_53f281f2ae80_258.jpg "alt=" Wkiol1ihqa7zxuayaabspnf9dsi681.jpg-wh_ "/>











This article is from the "Migrant Brother blog" blog, please be sure to keep this source http://mingongge.blog.51cto.com/2429897/1897432

The common face test set of Linux system operation and Maintenance Enterprise (III.)

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.