Linux command: ping command

ping command: ping command similar to the windows, used to test network host response ICMP request

ping options

  ping

    # -c             # number of executions

    -w #             long # test execution

    # -s             # ping packet to specify the size in bytes

    -f                  # ping up to do their best per second data packets, it can be attacked using ping

 

a network ping test script host online

! # / bin / the bash 
NET = " 192.168.4 " 
for I in { . 1 .. 254 }; do 
    { IF  of ping -C . 1 - W  . 1 . NET $ I $ &> / dev / null ; the then 
        echo $ NET. I >> $ / tmp / the ip.txt
     Fi ;} &                 # {} & put into the background task execution, perform the equivalent of a parallel task, efficiency 
DONE 
the wait                         # allows the wait after background task exits
 Sort -nt, ' . ' -K1, . 1 -k2, 2-K3, 3 -K4, 4 /tmp/ip.txt >> / tmp / ip_sort.txt    # sort order of ip address 

Note: performing an online host ping test, test 192.168.4.X segment by parallel tasks, and online host into /tmp/ip.txt file, and then sort the results sorted into /tmp/ip_sort.txt file

 

Guess you like

Origin www.cnblogs.com/ysuwangqiang/p/11528030.html