优秀是一种习惯
分类: LINUX
2013-01-14 21:30:36
此脚本只是快速查看所在局域网中其它主机的IP地址,如果对方设置了禁ping,则无法显示出此主机的IP地址:
[root@station1 桌面]# cat ping.sh #!/bin/bash for i in `seq 1 254` do { ping -c2 192.168.1.$i &>/dev/null && echo "192.168.1.$i is alive" }& done wait [root@station1 桌面]# time ./ping.sh 192.168.1.2 is alive 192.168.1.1 is alive 192.168.1.101 is alive real 0m11.918s user 0m0.142s sys 0m0.803s [root@station1 桌面]#