# 1、删除0字节文件 find -type f -size 0 -exec rm -f {} \; # 2、批量文件重命名 find . -type f -name "*.txt" -exec rename txt sh {} \; for i in `ls *.sh`;do rename sh txt $i;done # 3、查看http并发请求数及其TCP连接状态 netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}‘ # 4、文件内容批量替换 sed -i ‘/Root/s/no/yes/‘ /etc/ssh/sshd_config # 5、编写shell中显示多条信息 cat << EOF +--------------------------------------------------------------+ | === Welcome to Tunoff services === | +--------------------------------------------------------------+ EOF # 6、获取IP地址 awk sed cut tr # 7、批量新建用户并设置随机密码 # 8. 清除所有arp缓存 arp -n|awk ‘/^[1-9]/ {print "arp -d "$1}‘|sh # 9. 绑定已知机器的arp地址 cat /proc/net/arp | awk ‘{print $1 " " $4}‘ |sort -t. -n +3 -4 > /etc/ethers
时间: 2024-10-14 04:24:42