1 、找出ifconfig“网卡名”命令结果中本机的IPv4地址
centos6ifconfig eth0 | head -n2 |tail -n1 |tr -s " " : |cut -d: -f4centos7ifconfig ens33 |grep netmask |tr -s ' ' |cut -d " " -f3
2 、查出分区空间使用率的最大百分比值
df | grep /dev/sd |tr -s ' ' % | cut -d% -f5 | sort -nr | head -n1
3 、查出用户UID最大值的用户名、UID及shell 类型
cut -d: -f1,3,7 /etc/passwd | sort -t: -k2 -nr | head -n1
4 、查出/tmp的权限,以数字方式显示
stat /tmp | grep Uid | tr -s " " / | cut -d/ -f2 | cut -d"(" -f2
5 、统计当前连接本机的每个远程主机IP的连接数,并按从大
到小排序
netstat -tun | grep ESTAB | tr -s " " : | cut -d: -f6 | sort -nr | uniq -c
6、 ss -nt 查询并发连接的远程IP
ss -nt | tr -s " " : | grep ESTAB | cut -d: -f6
7、 判断主版本号
grep -o "[[:digit:]]\+" /etc/centos-release | head -n1
8、 取函数名
grep -o "^[[:alnum:]_]\+[[:space:]]*()" /etc/init.d/functions
9、 生成指定位数的随机口令
cat /dev/urandom |tr -dc '[:alnum:]_' |head -c20或tr -dc '[:alnum:]_' < /dev/urandom |head -c20或openssl rand -base64 30 |head -c20
