[True Interview Questions] High-frequency written test questions that appeared in the operation and maintenance interview in late September

  1. Capture the IP and display it in the format of IP:192.168.1.106
[root@ecs-c13b ~]# ifconfig |grep inet |awk '{print "IP:" $2}'|head -1
IP:192.168.0.192

  1. Match all lines starting with root
[root@zmedu106 ~]# awk /^root/ /etc/passwd
root:x:0:0:root:/root:/bin/bash
  1. Match all lines with root
[root@zmedu106 ~]# awk '/root/' passwd
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
  1. Count the top 10 most visited IPs in the nginx log
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr -k1 | head -n 10
  1. Detect the IP and the number of times of successful nginx access status code 200
cat  access.log |awk '{print $1,$9}'|grep '200'|sort | uniq -c|awk '{print $2" "$1}'

to sum up

A large part of the written test is to examine the ability of the script and the ability of the database. This part of the interview questions appears frequently and needs to be mastered carefully.

Guess you like

Origin blog.csdn.net/xinshuzhan/article/details/108768274