一些很有用的服务管理命令或者小脚本

探测局域网内有哪些机器
 #!/bin/bash
 # Change base address 192.168.0 according to your network.
 for ip in 192.168.142.{1..255} ;
 do
   (
      ping $ip -c2 &> /dev/null ;
      if [ $? -eq 0 ];
      then
      echo $ip is alive
      fi
   )&
   done

一次解压多个.tar.gz文件
find ./ -name '*.tar.gz' -exec tar zxvf {} ; -print

如何删去重复行并保持顺序不变?
awk '{ if (!seen[$0]++) { print $0; } }' $file_path

如何得到网卡的 MAC地址
 arp -a | awk '{print $4}'

如何在编写SHELL显示多个信息,用EOF
cat << EOF
+--------------------------------------------------------------+
|         === Welcome to Tunoff services ===                   |
+--------------------------------------------------------------+
EOF

让 linux自动同步时间
 vi /etc/crontab
 加上一句:
 00 0 1 * * root rdate -s time.nist.gov

一句话快速查找PHP木马的方法
find ./ -name "*.php" -type f -print0|xargs -0 egrep "(phpspy|c99sh|milw0rm|eval\(base64_decode|eval\(gzinflate\(base64_decode|eval\(gzinflate\(str_rot13\(base64_decode|spider_bc)"|awk -F: '{print $1}'|sort|uniq

按cpu利用率从大到小排列
ps -e  -o "%C  : %p : %z : %a"|sort  -nr

查看http的并发请求数及其TCP连接状态:
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

猜你喜欢

转载自www.cnblogs.com/xyz999/p/11717398.html