1. grep -v '/sbin/nologin' /etc/passwd|cut -d : -f 1
2. sort -t : -n -k3 /etc/passwd | tail -1 | cut -d : -f 1,3,7?
3. ss -nt | tail -n +2 | tr -s ' ' : | cut -d : -f 6 | sort | uniq -c | sort -n -r
4.
#!/bin/bash
maxdisk=`df | grep "/dev/sd" | tr -s " " ":" | cut -d : -f5 | sort -nr | head -n1`
maxuse=`df | grep "/dev/sd" | tr -s " " ":" | cut -d : -f1 | sort -nr | head -n1`
echo "磁盤"$maxuse"使用量為:"$maxdisk
5.
#!/bin/bash
echo -e "\e[1;32m**********************主機系統(tǒng)信息**********************\e[0m"
echo -e "\e[1;35m主機名:? ? ? `hostname`\e[0m"
echo -e "\e[1;35mIPv4地址:? ? `ifconfig ens33 | grep -Eo '(([0-9]|[1-9][0-9]|1[0-9]{,2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{,2}|2[0-4][0-9]|25[0-5])' | head -1`\e[0m"
echo -e "\e[1;35m操作系統(tǒng)版本: `cat /etc/redhat-release`\e[0m"
echo -e "\e[1;35m內(nèi)核版本:? ? `uname -r`\e[0m"
echo -e "\e[1;35mCPU型號:? ? `lscpu | grep 'Model name' | tr -s ' ' | cut -d : -f 2`\e[0m"
echo -e "\e[1;35m內(nèi)存大小:? ? $(free -h | tr -s ' ' : | cut -d : -f 2 | tail -n $(echo "`free -h | wc -l`-1" | bc) | head -1)\e[0m"
echo -e "\e[1;35m硬盤大小:? ? `lsblk | grep sda | head -1 | tr -s ' ' : | cut -d : -f 5`\e[0m"
echo -e "\e[1;32m********************************************************\e[0m"