1、统计出/etc/passwd文件中其默认shell为非/sbin/nologin的用户个数,并将用户都显示出来
[root@centos8-hkping ~]#grep -v '/sbin/nologin' /etc/passwd|wc -l
[root@centos8-hkping ~]#grep -v '/sbin/nologin' /etc/passwd|cut -d':' -f1
2、查出用户UID最大值的用户名、UID及shell类型
[root@centos8-hkping ~]#cat /etc/passwd|cut -d":" -f1,3,7|sort -t":" -k2 -n|tail -1
3、统计当前连接本机的每个远程主机IP的连接数,并按从大到小排序
[root@centos8-hkping ~]#ss -nt|grep -i estab|tr -s " "|cut -d" " -f3|sort -rn
4、编写脚本disk.sh,显示当前硬盘分区中空间利用率最大的值
vim disk.sh
#!/bin/bash
#
#********************************************************************
#Author: hkping
#QQ: 275597862
#Date: 2022-01-04
#FileName: disk.sh
#URL: http://
#Description: The test script
#Copyright (C): 2022 All rights reserved
#********************************************************************
df | grep '^/dev/sd'| egrep -o '[0-9]+%' | cut -d"%" -f1|sort -rn|head -1
:wq
5、编写脚本 systeminfo.sh,显示当前主机系统信息,包括:主机名,IPv4地址,操作系统版本,内核版本,CPU型号,内存大小,硬盘大小
vim systeminfo.sh
#FileName: systeminfo.sh
#URL: http://
#Description: The test script
#Copyright (C): 2022 All rights reserved
#********************************************************************
#主机名,IPv4地址,操作系统版本,内核版本, CPU型号,内存大小,硬盘大小
hostname=`hostname`
ipaddr=`ip a|grep eth0|grep inet|tr -s " "|cut -d" " -f3`
osversion=`cat /etc/redhat-release`
kernelversion=`cat /proc/version |cut -d " " -f3`
cpuinfo=`cat /proc/cpuinfo | grep 'model name'`
memsize=`cat /proc/meminfo | grep 'MemTotal'`
harddisksize=`fdisk -l|grep 'Disk /dev'`
echo "show this computer info"
echo "hostname:${hostname}"
echo "ipaddress:${ipaddr}"
echo "osversion:${osversion}"
echo "kernelversion:${kernelversion}"
echo "cpuinfo:${cpuinfo}"
echo "memsize:${memsize}"
echo "harddisksize:${harddisksize}"
:wq
6、20分钟内通关vimtutor(可参考https://yyqing.me/post/2017/2017-02-22-vimtutor-chinese-summary)
已完成,vim大部分操作已熟练