LINUX运维笔试题目

  • 描述Linux从启动到登录界面的过程
  • 描述DNS解析的过程
  • 二层交换与三层交换的区别
    • 参考此贴
  • 你管理着一台NGINX服务器,浏览器访问很缓慢。请分析可能的原因,并提出对策
  • IP: 23.56.243.1/20的网络地址是————
    • 20 means NetMask is: 255.255.0xF0:0
    • NetAddress = NetMask & 23.56.234.1 = 23.56.240.0
  • 添加默认路由192.168.1.1的SHELL命令

Linux route add using route command

Route all traffic via 192.168.1.254 gateway connected via eth0 network interface:

# route add default gw 192.168.1.254 eth0

Linux route add using ip command

Just like above but with ip command:

# ip route add 192.168.1.0/24 dev eth0

  • 查找PID为1234的可执行程序的启动目录
    • 注意是启动目录
    • 当前工作目录是:
      • sudo pwdx 1234
      • sudo realpath /proc/1234/cwd
    • 可执行程序的路径为:
      • sudo realpath /proc/1234/exe
      • sudo readlink /proc/1234/exe
  • 从如下stat.txt文件(来自NETSTAT命令的输出)统计各个IP出现的次数,并从大到小排序
    • 如以下命令的输出
    • netstat -lnt4 > stat.txt
    • william@ubuntu:~$ netstat -lnt4
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address           Foreign Address         State
      tcp        0      0 0.0.0.0:46225           0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:53429           0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
      tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:54234           0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN
      tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:9418            0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
      tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
      

    • william@ubuntu:~$ sed "1,2d" stat.txt | awk '{print $4}' | cut -d: -f1 | sort | uniq --count
            9 0.0.0.0
            2 127.0.0.1
      

      // google: shell count duplicate lines 

  • 用SQL语句,从职员表和部门表中,统计各个部门的人数,并从大到小排序
  • SELECT GroupId, COUNT(GroupId)
    FROM Members
    GROUP BY GroupId
    ORDER BY COUNT(GroupId) DESC



猜你喜欢

转载自blog.csdn.net/wileyoung/article/details/9625905