1、lnoi.sh: 列出当前系统下每个IP的连接数:
# cat lnoi.sh
#!/bin/bash # Use for list connect numbers and IP address. netstat -n | grep ‘^tcp‘ | grep -v ‘127.0.0.1‘ | awk ‘{print $5}‘ | cut -d: -f1 | sort | uniq -c | sort -rn | awk ‘BEGIN{printf "%-10s %s\n", "ConNum","IP"}{printf "%-11s%s\n", $1,$2}‘
2、lu.sh: 列出UID>=500并且!=65534的帐户:
# cat lu.sh
#!/bin/bash # Use for list conut for UID > 500 and not eq 65534. awk -F: ‘BEGIN{printf "%-15s%-7s%s\n%-s\n", "Username","UID","GID","=========================="} $3 >= 500 && $3 != 65534 {printf "%-15s%-7s%s\n", $1,$3,$4} END{printf "%s\n%s\n", "==========================","List Over"}‘ /etc/passwd
时间: 2025-01-01 12:04:45