1、统计出/etc/passwd文件中其默认shell为非/sbin/nologin的用户个数,并将用户都显示出来

[root@centos8 ~]# cat /etc/passwd | grep -v /sbin/nologin |wc -l
5

[root@centos8 ~]# cat /etc/passwd | grep -v '/sbin/nologin'|cut -d: -f1
root
sync
shutdown
halt
xiaozz

2、查出用户UID最大值的用户名、UID及shell类型

[root@centos8 ~]# cat /etc/passwd |sort -nr -t: -k3 |cut -d: -f1,3,7 |head -1 nobody:65534:/sbin/nologin

3、统计当前连接本机的每个远程主机IP的连接数,并按从大到小排序

[root@centos8 ~]# netstat -atunl | tr -s " " |cut -d " " -f5 | cut -d: -f1 | uniq -c |sort -nr 
      6 0.0.0.0
      5 0.0.0.0
      5 
      4 
      1 and
      1 Address
      1 8.43.85.14
      1 10.0.0.190
      1 10.0.0.1
      1 10.0.0.1
      1 0.0.0.0
[root@centos8 ~]# netstat -atunl | grep "ESTABLISHED" |tr -s " " |cut -d " " -f5 | cut -d: -f1 | uniq -c | sort -nr
      2 10.0.0.1
      1 10.0.0.190

4、编写脚本disk.sh,显示当前硬盘分区中空间利用率最大的值

#!/bin/bash
echo "disk use max :`df -h|grep ^/dev/[svm]d |tr -s " " "%"|cut -d% -f5|sort -rn|head -n1`"

5、编写脚本 systeminfo.sh,显示当前主机系统信息,包括:主机名,IPv4地址,操作系统版本,内核版本,CPU型号,内存大小,硬盘大小

#!/bin/bash
  
 RED="\E[1;31m"
 GREEN="echo -e \E[1;32m"
 END="\E[0m"
 $GREEN----------------------Host systeminfo--------------------$END
 echo -e  "HOSTNAME:     $RED`hostname`$END"
 echo -e  "IPADDR:       $RED` ifconfig ens33|grep -Eo '([0-9]{1,3}\.){3}[0-9]
 {1,3}' |head -n1`$END"
 echo -e  "OSVERSION:    $RED`cat /etc/redhat-release`$END"
 echo -e  "KERNEL:       $RED`uname -r`$END"
 echo -e  "CPU:         $RED`lscpu|grep 'Model name'|tr -s ' '|cut -d : -f2`$END"
 echo -e  "MEMORY:       $RED`free -h|grep Mem|tr -s ' ' : |cut -d : -f2`$END"
 echo -e  "DISK:         $RED`lsblk |grep '^sd' |tr -s ' ' |cut -d " " -f4`$END"
 $GREEN---------------------------------------------------------$END
[root@centos8 data]# bash systeminfo.sh
----------------------Host systeminfo--------------------
 HOSTNAME:     centos8.xiaozz.com
 IPADDR:        
 OSVERSION:    CentOS Linux release 8.4.2105
 KERNEL:       4.18.0-305.3.1.el8.x86_64
 CPU:          Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
 MEMORY:       1.7Gi
 DISK:         200G
20G
10G

6、20分钟内通关vimtutor(可参考https://yyqing.me/post/2017/2017-02-22-vimtutor-chinese-summary)

略!!!