标签:script linux bash
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
本文出自 “银凯的博客” 博客,请务必保留此出处http://yinkai.blog.51cto.com/3813923/1615523
标签:script linux bash
原文地址:http://yinkai.blog.51cto.com/3813923/1615523