How can I ping multiple IP addresses at the same time?Cannot Ping, nor Curl, but Nslookup worksFile /etc/resolv.conf deleted on every reboot, why or what?ping statistics time meaningBlock WAN Access - Allow LAN Access - Linux hostsHow to Disable Ping Response (ICMP echo) in Linux all the time?

A Caesar cipher in Python3

What is the equivalent of "if you say so" in German?

Decrypt T-SQL log backup header and read LSN

Why is the air inside airliners so dry (low humidity)?

Do any Star Trek characters play rock band instruments?

Call local emergency number using a foreign mobile number

Was Tim's reaction to the electric fence realistic?

Is it worth delving deep outside my field to revise a paper?

Locked out of my own server

Body swap, then building it back to health

are there any security risks of using user generated html tags?

How time is defined in astronomical science

Disable memory refresh on Z80

Can I say: “The train departs at 16 past every hour“?

What would an inclusive curriculum look like in a computer science course?

Is SSH key with passphrase a 2FA

Is it possible to save a (science) PhD in 10 months?

There are polygons with only right angles which have an odd number of corners

Instant coffee melts like chocolate

Equivalent of !$A.util.isEmpty() in LWC

Is putting money in a 401(k) plan risky?

Were mixed race kids theorized to look like zebras?

How to control the padding below a BarLegend?

How do I prevent against authentication side-channel attacks?



How can I ping multiple IP addresses at the same time?


Cannot Ping, nor Curl, but Nslookup worksFile /etc/resolv.conf deleted on every reboot, why or what?ping statistics time meaningBlock WAN Access - Allow LAN Access - Linux hostsHow to Disable Ping Response (ICMP echo) in Linux all the time?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









22

















I'm aware of the methods where you can run a Bash for loop and ping multiple servers, is there a Linux CLI tool that I can use which will allow for me to do this without having to resort to writing a Bash script to ping a list of servers one at a time?



Something like this:



$ ping host1 host2 host3


NOTE: I'm looking specifically for CentOS/Fedora, but if it works on other distros that's fine too.










share|improve this question





















  • 8





    Why are you against a little one-liner script doing that -- the beauty and philosophy of Linux ;-)? (Have small, simple programs and write the glue for special needs yourself.)

    – Peter - Reinstate Monica
    Jun 15 at 14:24







  • 1





    It's far easier to install a package from a repo vs. copying a script to 2000+ VMs 8-). I could easily write a script solution for myself. Also since I self-answered this I'm creating content on the Internet since I have users whom are asking for a single cmd vs. a shell script and were unsuccessful in finding a simple A'er to what they perceive as a basic Q.

    – slm
    Jun 15 at 15:55







  • 3





    If your intent is to do a multi-ping from 2000+ VMs, ... I still can only scratch my head

    – Hagen von Eitzen
    Jun 15 at 19:30











  • @HagenvonEitzen - nope, I'm installing tooling on 2000+ VMs so that users have tooling available to them to do such.

    – slm
    Jun 15 at 20:21






  • 1





    Why would you need this?

    – Tvde1
    Jun 17 at 10:24

















22

















I'm aware of the methods where you can run a Bash for loop and ping multiple servers, is there a Linux CLI tool that I can use which will allow for me to do this without having to resort to writing a Bash script to ping a list of servers one at a time?



Something like this:



$ ping host1 host2 host3


NOTE: I'm looking specifically for CentOS/Fedora, but if it works on other distros that's fine too.










share|improve this question





















  • 8





    Why are you against a little one-liner script doing that -- the beauty and philosophy of Linux ;-)? (Have small, simple programs and write the glue for special needs yourself.)

    – Peter - Reinstate Monica
    Jun 15 at 14:24







  • 1





    It's far easier to install a package from a repo vs. copying a script to 2000+ VMs 8-). I could easily write a script solution for myself. Also since I self-answered this I'm creating content on the Internet since I have users whom are asking for a single cmd vs. a shell script and were unsuccessful in finding a simple A'er to what they perceive as a basic Q.

    – slm
    Jun 15 at 15:55







  • 3





    If your intent is to do a multi-ping from 2000+ VMs, ... I still can only scratch my head

    – Hagen von Eitzen
    Jun 15 at 19:30











  • @HagenvonEitzen - nope, I'm installing tooling on 2000+ VMs so that users have tooling available to them to do such.

    – slm
    Jun 15 at 20:21






  • 1





    Why would you need this?

    – Tvde1
    Jun 17 at 10:24













22












22








22


4






I'm aware of the methods where you can run a Bash for loop and ping multiple servers, is there a Linux CLI tool that I can use which will allow for me to do this without having to resort to writing a Bash script to ping a list of servers one at a time?



Something like this:



$ ping host1 host2 host3


NOTE: I'm looking specifically for CentOS/Fedora, but if it works on other distros that's fine too.










share|improve this question















I'm aware of the methods where you can run a Bash for loop and ping multiple servers, is there a Linux CLI tool that I can use which will allow for me to do this without having to resort to writing a Bash script to ping a list of servers one at a time?



Something like this:



$ ping host1 host2 host3


NOTE: I'm looking specifically for CentOS/Fedora, but if it works on other distros that's fine too.







networking ping icmp






share|improve this question














share|improve this question











share|improve this question




share|improve this question










asked Jun 14 at 17:46









slmslm

272k77 gold badges591 silver badges735 bronze badges




272k77 gold badges591 silver badges735 bronze badges










  • 8





    Why are you against a little one-liner script doing that -- the beauty and philosophy of Linux ;-)? (Have small, simple programs and write the glue for special needs yourself.)

    – Peter - Reinstate Monica
    Jun 15 at 14:24







  • 1





    It's far easier to install a package from a repo vs. copying a script to 2000+ VMs 8-). I could easily write a script solution for myself. Also since I self-answered this I'm creating content on the Internet since I have users whom are asking for a single cmd vs. a shell script and were unsuccessful in finding a simple A'er to what they perceive as a basic Q.

    – slm
    Jun 15 at 15:55







  • 3





    If your intent is to do a multi-ping from 2000+ VMs, ... I still can only scratch my head

    – Hagen von Eitzen
    Jun 15 at 19:30











  • @HagenvonEitzen - nope, I'm installing tooling on 2000+ VMs so that users have tooling available to them to do such.

    – slm
    Jun 15 at 20:21






  • 1





    Why would you need this?

    – Tvde1
    Jun 17 at 10:24












  • 8





    Why are you against a little one-liner script doing that -- the beauty and philosophy of Linux ;-)? (Have small, simple programs and write the glue for special needs yourself.)

    – Peter - Reinstate Monica
    Jun 15 at 14:24







  • 1





    It's far easier to install a package from a repo vs. copying a script to 2000+ VMs 8-). I could easily write a script solution for myself. Also since I self-answered this I'm creating content on the Internet since I have users whom are asking for a single cmd vs. a shell script and were unsuccessful in finding a simple A'er to what they perceive as a basic Q.

    – slm
    Jun 15 at 15:55







  • 3





    If your intent is to do a multi-ping from 2000+ VMs, ... I still can only scratch my head

    – Hagen von Eitzen
    Jun 15 at 19:30











  • @HagenvonEitzen - nope, I'm installing tooling on 2000+ VMs so that users have tooling available to them to do such.

    – slm
    Jun 15 at 20:21






  • 1





    Why would you need this?

    – Tvde1
    Jun 17 at 10:24







8




8





Why are you against a little one-liner script doing that -- the beauty and philosophy of Linux ;-)? (Have small, simple programs and write the glue for special needs yourself.)

– Peter - Reinstate Monica
Jun 15 at 14:24






Why are you against a little one-liner script doing that -- the beauty and philosophy of Linux ;-)? (Have small, simple programs and write the glue for special needs yourself.)

– Peter - Reinstate Monica
Jun 15 at 14:24





1




1





It's far easier to install a package from a repo vs. copying a script to 2000+ VMs 8-). I could easily write a script solution for myself. Also since I self-answered this I'm creating content on the Internet since I have users whom are asking for a single cmd vs. a shell script and were unsuccessful in finding a simple A'er to what they perceive as a basic Q.

– slm
Jun 15 at 15:55






It's far easier to install a package from a repo vs. copying a script to 2000+ VMs 8-). I could easily write a script solution for myself. Also since I self-answered this I'm creating content on the Internet since I have users whom are asking for a single cmd vs. a shell script and were unsuccessful in finding a simple A'er to what they perceive as a basic Q.

– slm
Jun 15 at 15:55





3




3





If your intent is to do a multi-ping from 2000+ VMs, ... I still can only scratch my head

– Hagen von Eitzen
Jun 15 at 19:30





If your intent is to do a multi-ping from 2000+ VMs, ... I still can only scratch my head

– Hagen von Eitzen
Jun 15 at 19:30













@HagenvonEitzen - nope, I'm installing tooling on 2000+ VMs so that users have tooling available to them to do such.

– slm
Jun 15 at 20:21





@HagenvonEitzen - nope, I'm installing tooling on 2000+ VMs so that users have tooling available to them to do such.

– slm
Jun 15 at 20:21




1




1





Why would you need this?

– Tvde1
Jun 17 at 10:24





Why would you need this?

– Tvde1
Jun 17 at 10:24










12 Answers
12






active

oldest

votes


















32


















If you look into the NMAP project you'll find that it includes additional tools on top of just nmap. One of these tools is nping, which includes the following ability:




Nping has a very flexible and powerful command-line interface that
grants users full control over generated packets. Nping's features
include:



  • Custom TCP, UDP, ICMP and ARP packet generation.

  • Support for multiple target host specification.

  • Support for multiple target port specification.

  • ...



nping is in the standard EPEL repos to boot.



$ repoquery -qlf nmap.x86_64 | grep nping
/usr/bin/nping
/usr/share/man/man1/nping.1.gz


Usage



To ping multiple servers you merely have to tell nping the names/IPs and which protocol you want to use. Here since we want to mimic what the traditional ping CLI does we'll use ICMP.



$ sudo nping -c 2 --icmp scanme.nmap.org google.com

Starting Nping 0.7.70 ( https://nmap.org/nping ) at 2019-06-14 13:43 EDT
SENT (0.0088s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=1] IP [ttl=64 id=57921 iplen=28 ]
RCVD (0.0950s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=1] IP [ttl=46 id=24195 iplen=28 ]
SENT (1.0091s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
SENT (2.0105s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
RCVD (2.0107s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=2] IP [ttl=46 id=24465 iplen=28 ]
SENT (3.0138s) ICMP [10.3.144.95 > 64.233.177.100 Echo request (type=8/code=0) id=49169 seq=2] IP [ttl=64 id=57921 iplen=28 ]

Statistics for host scanme.nmap.org (45.33.32.156):
| Probes Sent: 2 | Rcvd: 2 | Lost: 0 (0.00%)
|_ Max rtt: 86.053ms | Min rtt: 0.188ms | Avg rtt: 43.120ms
Statistics for host google.com (64.233.177.100):
| Probes Sent: 2 | Rcvd: 0 | Lost: 2 (100.00%)
|_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
Raw packets sent: 4 (112B) | Rcvd: 2 (108B) | Lost: 2 (50.00%)
Nping done: 2 IP addresses pinged in 3.01 seconds


The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.



$ nping -c 2 --icmp scanme.nmap.org google.com
Mode ICMP requires root privileges.





share|improve this answer





















  • 3





    What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

    – JoL
    Jun 15 at 2:26







  • 4





    It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

    – JoL
    Jun 15 at 2:34












  • nmap also supports ICMP directly by specifying option -sn. See my answer for details.

    – scai
    Jun 17 at 11:27











  • @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

    – slm
    Jun 17 at 11:28







  • 1





    'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

    – Pryftan
    Jun 18 at 14:58


















18


















fping is in a Fedora package of the same name, and allows for many hosts, or a set of ip addressses.



$ fping -a -A -c 1 hosta hostb
192.168.0.20 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.64/0.64/0.64
192.168.1.3 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.50/0.50/0.50



fping will send out a ping packet and move on to the next target in a
round-robin fashion... if a target replies, it is noted and removed from
the list







share|improve this answer

































    9


















    oping host1 host2 host3


    Description:




    oping uses ICMP packages (better known as "ping packets") to test the reachability of network hosts. It supports pinging multiple hosts in parallel using IPv4 and/or IPv6 transparently.



    This package contains two command line applications: "oping" is a replacement for tools like ping(1), ping6(1) and fping(1). "noping" is an ncurses-based tool which displays statistics while pinging and highlights aberrant round-trip times.







    share|improve this answer


























    • Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

      – Pryftan
      Jun 18 at 15:01


















    7


















    I would suggest using GNU Parallel



    parallel -u ping ::: host1 host2 host3


    output will be interleaved






    share|improve this answer

































      6


















      I know it's specifically not what you are asking for, but a bash script to accomplish this:



      #!/bin/bash

      for host; do
      ping -c5 "$host" 2>&1 | tail -3 &
      done

      wait


      This will take your endpoints as command line arguments and send a 5 count ping to each one as a background process and then wait for all to finish before exiting. It will print the last three lines of the ping output which contains useful stats about the success rate and latency.






      share|improve this answer























      • 3





        You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

        – JoL
        Jun 15 at 2:51







      • 4





        A SIGINT trap would make this script a lot more practical.

        – Gilles 'SO- stop being evil'
        Jun 15 at 9:14






      • 2





        For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

        – Lie Ryan
        Jun 15 at 10:12






      • 2





        Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

        – Jesse_b
        Jun 15 at 13:08











      • @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

        – Pryftan
        Jun 18 at 15:03


















      2


















      I suppose this can do for you ?



      eval $(printf 'ping "%s" & ' host1 host2 host3)


      It takes advantage of printf's ability to "auto-iterate" its arguments while re-using its format string over each argument. The above printf therefore produces a sequence of ping <hostname> & strings for each host provided as argument, and feeds such sequence of commands through Command Substitution to the eval command to have them executed immediately.



      printf and eval commands are POSIX standard, as well as Command Substitution.



      Enclosing whole such command in a subshell comprising an and-ed wait like this:



      (eval $(printf 'ping "%s" & ' host1 host2 host3) && wait)


      provides the ability to interrupt everything at will with a simple Ctrl+C.



      Else you can control each ping command singularly through the shell's usual job control.



      If your shell has support also for Process Substitutions, you may also use the following:



      . <(printf 'ping "%s" & ' host1 host2 host3)


      for a few chars less to type.



      The gist is the same as for the eval, but feeds the sequence of pings to the . (aka source) command through the Process Substitution.






      share|improve this answer



































        2


















        Nmap supports ping scans (ICMP) and multiple hosts:



        nmap -sn -n 127.0.0.1 8.8.8.8



        You can also create a file containing all of your target IPs (separated by spaces or newlines) called targets.txt. Then run:



        nmap -sn -n -iL targets.txt



        Options explained:




        • -sn Ping Scan.


        • -n Disable DNS resolution.


        • -iL Input file name.

        Other interesting options in case you want to ping a really large number of targets:




        • -T4 Increase timing to reduce scan duration.


        • --min-parallelism 100 Increase number of parallel probes.


        • -oG <file> Write scan results to file in Grepable format.

        Without creating a file



        Keep in mind that you can also forgo the creation of a file and use a - to take input from either a pipe, |, or via traditional methods for redirecting output via STDIN.



        Examples:



        $ ( echo www.google.com; echo www.yahoo.com ) | sudo nmap -sn -n -iL -


        -or-



        $ sudo nmap -sn -n -iL - < <(echo www.google.com; echo www.yahoo.com)


        -or-



        $ sudo nmap -sn -n -iL - <<< $'www.google.comnwww.yahoo.com'


        References



        • Target Specification - Chapter 15. Nmap Reference Guide





        share|improve this answer



































          2


















          By using the common xargs command to build an execute multiple ping requests:



          echo host1 host2 host3 | xargs -n1 -P0 ping -c 4


          Where host1 host2 host3 can be a variable number of hosts (any combination of IP or hostname).



          This alters the xargs defaults to force 1 input argument per ping execution, and allow an unlimited number of parallel child processes (1 per pinged host). It is probably wise to set -P (aka --max-procs) to a sane value if intending to ping a large number of hosts (they'll all be processed; just fewer simultaneously).



          Its short enough to use directly, could be added as a function to your shell profile or rc file, or turned into tiny script in your $PATH. In the examples below, -P has been set to 10 to avoid excessive resource consumption.



          Example script: /usr/bin/mping



          #!/bin/sh

          echo $@ | xargs -n1 -P10 ping -c4


          Example function within ~/.bashrc



          function mping() 
          echo $@


          And use as:



          mping host1 host2 host3 ...





          share|improve this answer





















          • 1





            You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

            – Criggie
            Jun 18 at 0:22






          • 1





            Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

            – Jason Musgrove
            Jun 18 at 7:37


















          1


















          I do not know what you want exactly but you could change the last 8 bit-set into the decimal 255, so your hosts will receive a broadcast, actually,it will transmit ping packets to all devices that exist in a network.



          ping -c 1 xx.xx.xx.255





          share|improve this answer





















          • 1





            That's not what I'm looking for.

            – slm
            Jun 14 at 20:38






          • 8





            Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

            – Criggie
            Jun 16 at 3:45


















          0


















          ping google.com && ping localhost


          Output



          Pinging google.com [xxxxxxx] with 32 bytes of data:
          Reply from xxxxxxx: bytes=32 time=210ms TTL=49
          Reply from ::1: time<1ms
          Reply from xxxxxxx: bytes=32 time=212ms TTL=49
          Reply from ::1: time<1ms
          Reply from xxxxxxx: bytes=32 time=211ms TTL=49
          Reply from ::1: time<1ms





          share|improve this answer


























          • Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

            – Criggie
            Jun 18 at 0:24


















          -1


















          Just for fun and profit...



          #!/bin/sh -

          # sends six "pings" to a list of hosts defined in "hosts" below

          hosts="
          host.a
          host.b
          host.c
          host.d
          host.e
          "

          for p in $hosts
          do
          # ONLY CHOOSE ONE OF THE FOLLOWING, NOT BOTH
          # dump results to file
          ping -c 6 $p >>./PINGED
          # dump output to console
          ping -c 6 $p
          done

          exit


          This could be easily enhanced. Which makes it pretty useful. :)



          For additional options please see the man pages for bsd ping and Linux ping



          HTH



          EDIT: slightly updated to terminate the ping queries @6 pings each, and add man page options.






          share|improve this answer




























          • The first ping call never returns unless it hits a fatal error.

            – Gilles 'SO- stop being evil'
            Jun 15 at 9:14











          • Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

            – somebody
            Jun 15 at 9:28






          • 2





            Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

            – Gilles 'SO- stop being evil'
            Jun 15 at 9:43












          • Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

            – somebody
            Jun 15 at 9:49






          • 1





            What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

            – somebody
            Jun 16 at 9:59



















          -2


















          Use below simple command:



          $ getip() tr -d '()' 2>&1 




          $ getip 'hostname.number1.net'
          $ getip 'hostname.number2.net'
          $ getip 'hostname.number3.net'
          $ getip 'hostname.number4.net'
          $ getip 'hostname.number5.net'
          $ getip 'hostname.number6.net'
          $ getip 'hostname.number7.net'
          $ getip 'hostname.number8.net'




          $ cat /tmp/result.log
          ABC.DEF.GHI.XY1
          ABC.DEF.GHI.XY2
          ABC.DEF.GHI.XY3
          ABC.DEF.GHI.XY4
          ABC.DEF.GHI.XY5
          ABC.DEF.GHI.XY6
          ABC.DEF.GHI.XY7
          ABC.DEF.GHI.XY8





          share|improve this answer





























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f524963%2fhow-can-i-ping-multiple-ip-addresses-at-the-same-time%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown


























            12 Answers
            12






            active

            oldest

            votes








            12 Answers
            12






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            32


















            If you look into the NMAP project you'll find that it includes additional tools on top of just nmap. One of these tools is nping, which includes the following ability:




            Nping has a very flexible and powerful command-line interface that
            grants users full control over generated packets. Nping's features
            include:



            • Custom TCP, UDP, ICMP and ARP packet generation.

            • Support for multiple target host specification.

            • Support for multiple target port specification.

            • ...



            nping is in the standard EPEL repos to boot.



            $ repoquery -qlf nmap.x86_64 | grep nping
            /usr/bin/nping
            /usr/share/man/man1/nping.1.gz


            Usage



            To ping multiple servers you merely have to tell nping the names/IPs and which protocol you want to use. Here since we want to mimic what the traditional ping CLI does we'll use ICMP.



            $ sudo nping -c 2 --icmp scanme.nmap.org google.com

            Starting Nping 0.7.70 ( https://nmap.org/nping ) at 2019-06-14 13:43 EDT
            SENT (0.0088s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=1] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (0.0950s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=1] IP [ttl=46 id=24195 iplen=28 ]
            SENT (1.0091s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            SENT (2.0105s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (2.0107s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=2] IP [ttl=46 id=24465 iplen=28 ]
            SENT (3.0138s) ICMP [10.3.144.95 > 64.233.177.100 Echo request (type=8/code=0) id=49169 seq=2] IP [ttl=64 id=57921 iplen=28 ]

            Statistics for host scanme.nmap.org (45.33.32.156):
            | Probes Sent: 2 | Rcvd: 2 | Lost: 0 (0.00%)
            |_ Max rtt: 86.053ms | Min rtt: 0.188ms | Avg rtt: 43.120ms
            Statistics for host google.com (64.233.177.100):
            | Probes Sent: 2 | Rcvd: 0 | Lost: 2 (100.00%)
            |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
            Raw packets sent: 4 (112B) | Rcvd: 2 (108B) | Lost: 2 (50.00%)
            Nping done: 2 IP addresses pinged in 3.01 seconds


            The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.



            $ nping -c 2 --icmp scanme.nmap.org google.com
            Mode ICMP requires root privileges.





            share|improve this answer





















            • 3





              What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

              – JoL
              Jun 15 at 2:26







            • 4





              It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

              – JoL
              Jun 15 at 2:34












            • nmap also supports ICMP directly by specifying option -sn. See my answer for details.

              – scai
              Jun 17 at 11:27











            • @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

              – slm
              Jun 17 at 11:28







            • 1





              'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

              – Pryftan
              Jun 18 at 14:58















            32


















            If you look into the NMAP project you'll find that it includes additional tools on top of just nmap. One of these tools is nping, which includes the following ability:




            Nping has a very flexible and powerful command-line interface that
            grants users full control over generated packets. Nping's features
            include:



            • Custom TCP, UDP, ICMP and ARP packet generation.

            • Support for multiple target host specification.

            • Support for multiple target port specification.

            • ...



            nping is in the standard EPEL repos to boot.



            $ repoquery -qlf nmap.x86_64 | grep nping
            /usr/bin/nping
            /usr/share/man/man1/nping.1.gz


            Usage



            To ping multiple servers you merely have to tell nping the names/IPs and which protocol you want to use. Here since we want to mimic what the traditional ping CLI does we'll use ICMP.



            $ sudo nping -c 2 --icmp scanme.nmap.org google.com

            Starting Nping 0.7.70 ( https://nmap.org/nping ) at 2019-06-14 13:43 EDT
            SENT (0.0088s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=1] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (0.0950s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=1] IP [ttl=46 id=24195 iplen=28 ]
            SENT (1.0091s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            SENT (2.0105s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (2.0107s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=2] IP [ttl=46 id=24465 iplen=28 ]
            SENT (3.0138s) ICMP [10.3.144.95 > 64.233.177.100 Echo request (type=8/code=0) id=49169 seq=2] IP [ttl=64 id=57921 iplen=28 ]

            Statistics for host scanme.nmap.org (45.33.32.156):
            | Probes Sent: 2 | Rcvd: 2 | Lost: 0 (0.00%)
            |_ Max rtt: 86.053ms | Min rtt: 0.188ms | Avg rtt: 43.120ms
            Statistics for host google.com (64.233.177.100):
            | Probes Sent: 2 | Rcvd: 0 | Lost: 2 (100.00%)
            |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
            Raw packets sent: 4 (112B) | Rcvd: 2 (108B) | Lost: 2 (50.00%)
            Nping done: 2 IP addresses pinged in 3.01 seconds


            The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.



            $ nping -c 2 --icmp scanme.nmap.org google.com
            Mode ICMP requires root privileges.





            share|improve this answer





















            • 3





              What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

              – JoL
              Jun 15 at 2:26







            • 4





              It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

              – JoL
              Jun 15 at 2:34












            • nmap also supports ICMP directly by specifying option -sn. See my answer for details.

              – scai
              Jun 17 at 11:27











            • @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

              – slm
              Jun 17 at 11:28







            • 1





              'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

              – Pryftan
              Jun 18 at 14:58













            32














            32










            32









            If you look into the NMAP project you'll find that it includes additional tools on top of just nmap. One of these tools is nping, which includes the following ability:




            Nping has a very flexible and powerful command-line interface that
            grants users full control over generated packets. Nping's features
            include:



            • Custom TCP, UDP, ICMP and ARP packet generation.

            • Support for multiple target host specification.

            • Support for multiple target port specification.

            • ...



            nping is in the standard EPEL repos to boot.



            $ repoquery -qlf nmap.x86_64 | grep nping
            /usr/bin/nping
            /usr/share/man/man1/nping.1.gz


            Usage



            To ping multiple servers you merely have to tell nping the names/IPs and which protocol you want to use. Here since we want to mimic what the traditional ping CLI does we'll use ICMP.



            $ sudo nping -c 2 --icmp scanme.nmap.org google.com

            Starting Nping 0.7.70 ( https://nmap.org/nping ) at 2019-06-14 13:43 EDT
            SENT (0.0088s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=1] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (0.0950s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=1] IP [ttl=46 id=24195 iplen=28 ]
            SENT (1.0091s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            SENT (2.0105s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (2.0107s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=2] IP [ttl=46 id=24465 iplen=28 ]
            SENT (3.0138s) ICMP [10.3.144.95 > 64.233.177.100 Echo request (type=8/code=0) id=49169 seq=2] IP [ttl=64 id=57921 iplen=28 ]

            Statistics for host scanme.nmap.org (45.33.32.156):
            | Probes Sent: 2 | Rcvd: 2 | Lost: 0 (0.00%)
            |_ Max rtt: 86.053ms | Min rtt: 0.188ms | Avg rtt: 43.120ms
            Statistics for host google.com (64.233.177.100):
            | Probes Sent: 2 | Rcvd: 0 | Lost: 2 (100.00%)
            |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
            Raw packets sent: 4 (112B) | Rcvd: 2 (108B) | Lost: 2 (50.00%)
            Nping done: 2 IP addresses pinged in 3.01 seconds


            The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.



            $ nping -c 2 --icmp scanme.nmap.org google.com
            Mode ICMP requires root privileges.





            share|improve this answer














            If you look into the NMAP project you'll find that it includes additional tools on top of just nmap. One of these tools is nping, which includes the following ability:




            Nping has a very flexible and powerful command-line interface that
            grants users full control over generated packets. Nping's features
            include:



            • Custom TCP, UDP, ICMP and ARP packet generation.

            • Support for multiple target host specification.

            • Support for multiple target port specification.

            • ...



            nping is in the standard EPEL repos to boot.



            $ repoquery -qlf nmap.x86_64 | grep nping
            /usr/bin/nping
            /usr/share/man/man1/nping.1.gz


            Usage



            To ping multiple servers you merely have to tell nping the names/IPs and which protocol you want to use. Here since we want to mimic what the traditional ping CLI does we'll use ICMP.



            $ sudo nping -c 2 --icmp scanme.nmap.org google.com

            Starting Nping 0.7.70 ( https://nmap.org/nping ) at 2019-06-14 13:43 EDT
            SENT (0.0088s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=1] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (0.0950s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=1] IP [ttl=46 id=24195 iplen=28 ]
            SENT (1.0091s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            SENT (2.0105s) ICMP [10.3.144.95 > 45.33.32.156 Echo request (type=8/code=0) id=42074 seq=2] IP [ttl=64 id=57921 iplen=28 ]
            RCVD (2.0107s) ICMP [45.33.32.156 > 10.3.144.95 Echo reply (type=0/code=0) id=42074 seq=2] IP [ttl=46 id=24465 iplen=28 ]
            SENT (3.0138s) ICMP [10.3.144.95 > 64.233.177.100 Echo request (type=8/code=0) id=49169 seq=2] IP [ttl=64 id=57921 iplen=28 ]

            Statistics for host scanme.nmap.org (45.33.32.156):
            | Probes Sent: 2 | Rcvd: 2 | Lost: 0 (0.00%)
            |_ Max rtt: 86.053ms | Min rtt: 0.188ms | Avg rtt: 43.120ms
            Statistics for host google.com (64.233.177.100):
            | Probes Sent: 2 | Rcvd: 0 | Lost: 2 (100.00%)
            |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
            Raw packets sent: 4 (112B) | Rcvd: 2 (108B) | Lost: 2 (50.00%)
            Nping done: 2 IP addresses pinged in 3.01 seconds


            The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.



            $ nping -c 2 --icmp scanme.nmap.org google.com
            Mode ICMP requires root privileges.






            share|improve this answer













            share|improve this answer




            share|improve this answer










            answered Jun 14 at 17:46









            slmslm

            272k77 gold badges591 silver badges735 bronze badges




            272k77 gold badges591 silver badges735 bronze badges










            • 3





              What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

              – JoL
              Jun 15 at 2:26







            • 4





              It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

              – JoL
              Jun 15 at 2:34












            • nmap also supports ICMP directly by specifying option -sn. See my answer for details.

              – scai
              Jun 17 at 11:27











            • @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

              – slm
              Jun 17 at 11:28







            • 1





              'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

              – Pryftan
              Jun 18 at 14:58












            • 3





              What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

              – JoL
              Jun 15 at 2:26







            • 4





              It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

              – JoL
              Jun 15 at 2:34












            • nmap also supports ICMP directly by specifying option -sn. See my answer for details.

              – scai
              Jun 17 at 11:27











            • @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

              – slm
              Jun 17 at 11:28







            • 1





              'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

              – Pryftan
              Jun 18 at 14:58







            3




            3





            What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

            – JoL
            Jun 15 at 2:26






            What's with that output? The statistics say it sent 2 to each host, but the previous output shows it sent 3 to scanme.nmap.org (45.33.32.156) and 1 to google.com (64.233.177.100). It happens to me too when I run it.

            – JoL
            Jun 15 at 2:26





            4




            4





            It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

            – JoL
            Jun 15 at 2:34






            It lies... (of course though, since it's inconsistent with itself). On running it with strace, I can see it sending a ping to google.com, but outputting a line saying it sent it to scanme.nmap.org. Interesting bug. It doesn't always happen, though.

            – JoL
            Jun 15 at 2:34














            nmap also supports ICMP directly by specifying option -sn. See my answer for details.

            – scai
            Jun 17 at 11:27





            nmap also supports ICMP directly by specifying option -sn. See my answer for details.

            – scai
            Jun 17 at 11:27













            @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

            – slm
            Jun 17 at 11:28






            @scai - thanks for your A'er. I found that one as well while researching this. I found my approach to be the cleanest.

            – slm
            Jun 17 at 11:28





            1




            1





            'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

            – Pryftan
            Jun 18 at 14:58





            'The only drawback I've found with this tool is the use of ICMP mode requiring root privileges.' Yes that's an interesting thing but it has to do with capabilities (in Linux at least; you could also do setuid exec for root). Not that I recommend using setcap or giving it setuid ....

            – Pryftan
            Jun 18 at 14:58













            18


















            fping is in a Fedora package of the same name, and allows for many hosts, or a set of ip addressses.



            $ fping -a -A -c 1 hosta hostb
            192.168.0.20 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.64/0.64/0.64
            192.168.1.3 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.50/0.50/0.50



            fping will send out a ping packet and move on to the next target in a
            round-robin fashion... if a target replies, it is noted and removed from
            the list







            share|improve this answer






























              18


















              fping is in a Fedora package of the same name, and allows for many hosts, or a set of ip addressses.



              $ fping -a -A -c 1 hosta hostb
              192.168.0.20 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.64/0.64/0.64
              192.168.1.3 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.50/0.50/0.50



              fping will send out a ping packet and move on to the next target in a
              round-robin fashion... if a target replies, it is noted and removed from
              the list







              share|improve this answer




























                18














                18










                18









                fping is in a Fedora package of the same name, and allows for many hosts, or a set of ip addressses.



                $ fping -a -A -c 1 hosta hostb
                192.168.0.20 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.64/0.64/0.64
                192.168.1.3 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.50/0.50/0.50



                fping will send out a ping packet and move on to the next target in a
                round-robin fashion... if a target replies, it is noted and removed from
                the list







                share|improve this answer














                fping is in a Fedora package of the same name, and allows for many hosts, or a set of ip addressses.



                $ fping -a -A -c 1 hosta hostb
                192.168.0.20 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.64/0.64/0.64
                192.168.1.3 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.50/0.50/0.50



                fping will send out a ping packet and move on to the next target in a
                round-robin fashion... if a target replies, it is noted and removed from
                the list








                share|improve this answer













                share|improve this answer




                share|improve this answer










                answered Jun 14 at 19:44









                meuhmeuh

                34.7k1 gold badge26 silver badges62 bronze badges




                34.7k1 gold badge26 silver badges62 bronze badges
























                    9


















                    oping host1 host2 host3


                    Description:




                    oping uses ICMP packages (better known as "ping packets") to test the reachability of network hosts. It supports pinging multiple hosts in parallel using IPv4 and/or IPv6 transparently.



                    This package contains two command line applications: "oping" is a replacement for tools like ping(1), ping6(1) and fping(1). "noping" is an ncurses-based tool which displays statistics while pinging and highlights aberrant round-trip times.







                    share|improve this answer


























                    • Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

                      – Pryftan
                      Jun 18 at 15:01















                    9


















                    oping host1 host2 host3


                    Description:




                    oping uses ICMP packages (better known as "ping packets") to test the reachability of network hosts. It supports pinging multiple hosts in parallel using IPv4 and/or IPv6 transparently.



                    This package contains two command line applications: "oping" is a replacement for tools like ping(1), ping6(1) and fping(1). "noping" is an ncurses-based tool which displays statistics while pinging and highlights aberrant round-trip times.







                    share|improve this answer


























                    • Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

                      – Pryftan
                      Jun 18 at 15:01













                    9














                    9










                    9









                    oping host1 host2 host3


                    Description:




                    oping uses ICMP packages (better known as "ping packets") to test the reachability of network hosts. It supports pinging multiple hosts in parallel using IPv4 and/or IPv6 transparently.



                    This package contains two command line applications: "oping" is a replacement for tools like ping(1), ping6(1) and fping(1). "noping" is an ncurses-based tool which displays statistics while pinging and highlights aberrant round-trip times.







                    share|improve this answer














                    oping host1 host2 host3


                    Description:




                    oping uses ICMP packages (better known as "ping packets") to test the reachability of network hosts. It supports pinging multiple hosts in parallel using IPv4 and/or IPv6 transparently.



                    This package contains two command line applications: "oping" is a replacement for tools like ping(1), ping6(1) and fping(1). "noping" is an ncurses-based tool which displays statistics while pinging and highlights aberrant round-trip times.








                    share|improve this answer













                    share|improve this answer




                    share|improve this answer










                    answered Jun 14 at 20:57









                    GAD3RGAD3R

                    32.7k19 gold badges67 silver badges126 bronze badges




                    32.7k19 gold badges67 silver badges126 bronze badges















                    • Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

                      – Pryftan
                      Jun 18 at 15:01

















                    • Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

                      – Pryftan
                      Jun 18 at 15:01
















                    Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

                    – Pryftan
                    Jun 18 at 15:01





                    Just to be pedantic: technically ICMP is for error reporting in general and there are many different capabilities it has. In fact ping uses ECHO_REQUEST/ECHO_REPLY types of ICMP (8 for the former iirc but it's been a long time - and I’m too lazy to check). Maybe the description you quote is actually for the oping itself but either way it's not strictly correct (or it's much more simplified than it should be ... Or maybe not, I guess for many it probably is better that way but not for me anyway).

                    – Pryftan
                    Jun 18 at 15:01











                    7


















                    I would suggest using GNU Parallel



                    parallel -u ping ::: host1 host2 host3


                    output will be interleaved






                    share|improve this answer






























                      7


















                      I would suggest using GNU Parallel



                      parallel -u ping ::: host1 host2 host3


                      output will be interleaved






                      share|improve this answer




























                        7














                        7










                        7









                        I would suggest using GNU Parallel



                        parallel -u ping ::: host1 host2 host3


                        output will be interleaved






                        share|improve this answer














                        I would suggest using GNU Parallel



                        parallel -u ping ::: host1 host2 host3


                        output will be interleaved







                        share|improve this answer













                        share|improve this answer




                        share|improve this answer










                        answered Jun 17 at 16:20









                        Diaa SamiDiaa Sami

                        3402 silver badges6 bronze badges




                        3402 silver badges6 bronze badges
























                            6


















                            I know it's specifically not what you are asking for, but a bash script to accomplish this:



                            #!/bin/bash

                            for host; do
                            ping -c5 "$host" 2>&1 | tail -3 &
                            done

                            wait


                            This will take your endpoints as command line arguments and send a 5 count ping to each one as a background process and then wait for all to finish before exiting. It will print the last three lines of the ping output which contains useful stats about the success rate and latency.






                            share|improve this answer























                            • 3





                              You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

                              – JoL
                              Jun 15 at 2:51







                            • 4





                              A SIGINT trap would make this script a lot more practical.

                              – Gilles 'SO- stop being evil'
                              Jun 15 at 9:14






                            • 2





                              For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

                              – Lie Ryan
                              Jun 15 at 10:12






                            • 2





                              Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

                              – Jesse_b
                              Jun 15 at 13:08











                            • @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

                              – Pryftan
                              Jun 18 at 15:03















                            6


















                            I know it's specifically not what you are asking for, but a bash script to accomplish this:



                            #!/bin/bash

                            for host; do
                            ping -c5 "$host" 2>&1 | tail -3 &
                            done

                            wait


                            This will take your endpoints as command line arguments and send a 5 count ping to each one as a background process and then wait for all to finish before exiting. It will print the last three lines of the ping output which contains useful stats about the success rate and latency.






                            share|improve this answer























                            • 3





                              You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

                              – JoL
                              Jun 15 at 2:51







                            • 4





                              A SIGINT trap would make this script a lot more practical.

                              – Gilles 'SO- stop being evil'
                              Jun 15 at 9:14






                            • 2





                              For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

                              – Lie Ryan
                              Jun 15 at 10:12






                            • 2





                              Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

                              – Jesse_b
                              Jun 15 at 13:08











                            • @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

                              – Pryftan
                              Jun 18 at 15:03













                            6














                            6










                            6









                            I know it's specifically not what you are asking for, but a bash script to accomplish this:



                            #!/bin/bash

                            for host; do
                            ping -c5 "$host" 2>&1 | tail -3 &
                            done

                            wait


                            This will take your endpoints as command line arguments and send a 5 count ping to each one as a background process and then wait for all to finish before exiting. It will print the last three lines of the ping output which contains useful stats about the success rate and latency.






                            share|improve this answer
















                            I know it's specifically not what you are asking for, but a bash script to accomplish this:



                            #!/bin/bash

                            for host; do
                            ping -c5 "$host" 2>&1 | tail -3 &
                            done

                            wait


                            This will take your endpoints as command line arguments and send a 5 count ping to each one as a background process and then wait for all to finish before exiting. It will print the last three lines of the ping output which contains useful stats about the success rate and latency.







                            share|improve this answer















                            share|improve this answer




                            share|improve this answer








                            edited Jun 15 at 13:05

























                            answered Jun 14 at 18:41









                            Jesse_bJesse_b

                            19.9k3 gold badges47 silver badges90 bronze badges




                            19.9k3 gold badges47 silver badges90 bronze badges










                            • 3





                              You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

                              – JoL
                              Jun 15 at 2:51







                            • 4





                              A SIGINT trap would make this script a lot more practical.

                              – Gilles 'SO- stop being evil'
                              Jun 15 at 9:14






                            • 2





                              For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

                              – Lie Ryan
                              Jun 15 at 10:12






                            • 2





                              Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

                              – Jesse_b
                              Jun 15 at 13:08











                            • @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

                              – Pryftan
                              Jun 18 at 15:03












                            • 3





                              You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

                              – JoL
                              Jun 15 at 2:51







                            • 4





                              A SIGINT trap would make this script a lot more practical.

                              – Gilles 'SO- stop being evil'
                              Jun 15 at 9:14






                            • 2





                              For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

                              – Lie Ryan
                              Jun 15 at 10:12






                            • 2





                              Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

                              – Jesse_b
                              Jun 15 at 13:08











                            • @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

                              – Pryftan
                              Jun 18 at 15:03







                            3




                            3





                            You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

                            – JoL
                            Jun 15 at 2:51






                            You don't need to remember the pids. A simple wait will wait for all active child processes, so you can avoid the second loop. I think part of the reason why it was asked to not require writing a bash script is to have a solution that works on any machine without having to carry around or write a script. Making it short seems more favorable, so I would think it better to avoid that argument assignment and just do for host; do in your first loop. If this were zsh, you could avoid the do and done and just do, interatively: for host in google.com; ping -c5 "$host" |& tail -3 & wait

                            – JoL
                            Jun 15 at 2:51





                            4




                            4





                            A SIGINT trap would make this script a lot more practical.

                            – Gilles 'SO- stop being evil'
                            Jun 15 at 9:14





                            A SIGINT trap would make this script a lot more practical.

                            – Gilles 'SO- stop being evil'
                            Jun 15 at 9:14




                            2




                            2





                            For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

                            – Lie Ryan
                            Jun 15 at 10:12





                            For interactive use, this is simply using background command (i.e. command &) in a subshell (i.e. wrapping with parens) and with wait to combine any number of commands into one artificial command, for example: (for f in google.com yahoo.com microsoft.com; do ping $f & done; wait). Their outputs will be interleaved, and when you ctrl+c this after this command, all three child processes will be killed. The shell has a lot of powerful job control constructs and this is one of them.

                            – Lie Ryan
                            Jun 15 at 10:12




                            2




                            2





                            Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

                            – Jesse_b
                            Jun 15 at 13:08





                            Thanks all. Yeah I was hesitant to post it but I figure Q/A's on here are not just for OP but for everyone experiencing a similar problem and I figure there are going to be people that stumble across this question and don't want to install additional software to accomplish the task.

                            – Jesse_b
                            Jun 15 at 13:08













                            @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

                            – Pryftan
                            Jun 18 at 15:03





                            @JoL But certainly those tools aren't installed by default on all hosts. That doesn't make what you say untrue of course but...

                            – Pryftan
                            Jun 18 at 15:03











                            2


















                            I suppose this can do for you ?



                            eval $(printf 'ping "%s" & ' host1 host2 host3)


                            It takes advantage of printf's ability to "auto-iterate" its arguments while re-using its format string over each argument. The above printf therefore produces a sequence of ping <hostname> & strings for each host provided as argument, and feeds such sequence of commands through Command Substitution to the eval command to have them executed immediately.



                            printf and eval commands are POSIX standard, as well as Command Substitution.



                            Enclosing whole such command in a subshell comprising an and-ed wait like this:



                            (eval $(printf 'ping "%s" & ' host1 host2 host3) && wait)


                            provides the ability to interrupt everything at will with a simple Ctrl+C.



                            Else you can control each ping command singularly through the shell's usual job control.



                            If your shell has support also for Process Substitutions, you may also use the following:



                            . <(printf 'ping "%s" & ' host1 host2 host3)


                            for a few chars less to type.



                            The gist is the same as for the eval, but feeds the sequence of pings to the . (aka source) command through the Process Substitution.






                            share|improve this answer
































                              2


















                              I suppose this can do for you ?



                              eval $(printf 'ping "%s" & ' host1 host2 host3)


                              It takes advantage of printf's ability to "auto-iterate" its arguments while re-using its format string over each argument. The above printf therefore produces a sequence of ping <hostname> & strings for each host provided as argument, and feeds such sequence of commands through Command Substitution to the eval command to have them executed immediately.



                              printf and eval commands are POSIX standard, as well as Command Substitution.



                              Enclosing whole such command in a subshell comprising an and-ed wait like this:



                              (eval $(printf 'ping "%s" & ' host1 host2 host3) && wait)


                              provides the ability to interrupt everything at will with a simple Ctrl+C.



                              Else you can control each ping command singularly through the shell's usual job control.



                              If your shell has support also for Process Substitutions, you may also use the following:



                              . <(printf 'ping "%s" & ' host1 host2 host3)


                              for a few chars less to type.



                              The gist is the same as for the eval, but feeds the sequence of pings to the . (aka source) command through the Process Substitution.






                              share|improve this answer






























                                2














                                2










                                2









                                I suppose this can do for you ?



                                eval $(printf 'ping "%s" & ' host1 host2 host3)


                                It takes advantage of printf's ability to "auto-iterate" its arguments while re-using its format string over each argument. The above printf therefore produces a sequence of ping <hostname> & strings for each host provided as argument, and feeds such sequence of commands through Command Substitution to the eval command to have them executed immediately.



                                printf and eval commands are POSIX standard, as well as Command Substitution.



                                Enclosing whole such command in a subshell comprising an and-ed wait like this:



                                (eval $(printf 'ping "%s" & ' host1 host2 host3) && wait)


                                provides the ability to interrupt everything at will with a simple Ctrl+C.



                                Else you can control each ping command singularly through the shell's usual job control.



                                If your shell has support also for Process Substitutions, you may also use the following:



                                . <(printf 'ping "%s" & ' host1 host2 host3)


                                for a few chars less to type.



                                The gist is the same as for the eval, but feeds the sequence of pings to the . (aka source) command through the Process Substitution.






                                share|improve this answer
















                                I suppose this can do for you ?



                                eval $(printf 'ping "%s" & ' host1 host2 host3)


                                It takes advantage of printf's ability to "auto-iterate" its arguments while re-using its format string over each argument. The above printf therefore produces a sequence of ping <hostname> & strings for each host provided as argument, and feeds such sequence of commands through Command Substitution to the eval command to have them executed immediately.



                                printf and eval commands are POSIX standard, as well as Command Substitution.



                                Enclosing whole such command in a subshell comprising an and-ed wait like this:



                                (eval $(printf 'ping "%s" & ' host1 host2 host3) && wait)


                                provides the ability to interrupt everything at will with a simple Ctrl+C.



                                Else you can control each ping command singularly through the shell's usual job control.



                                If your shell has support also for Process Substitutions, you may also use the following:



                                . <(printf 'ping "%s" & ' host1 host2 host3)


                                for a few chars less to type.



                                The gist is the same as for the eval, but feeds the sequence of pings to the . (aka source) command through the Process Substitution.







                                share|improve this answer















                                share|improve this answer




                                share|improve this answer








                                edited Jun 15 at 18:25

























                                answered Jun 15 at 17:33









                                LL3LL3

                                2,2022 silver badges14 bronze badges




                                2,2022 silver badges14 bronze badges
























                                    2


















                                    Nmap supports ping scans (ICMP) and multiple hosts:



                                    nmap -sn -n 127.0.0.1 8.8.8.8



                                    You can also create a file containing all of your target IPs (separated by spaces or newlines) called targets.txt. Then run:



                                    nmap -sn -n -iL targets.txt



                                    Options explained:




                                    • -sn Ping Scan.


                                    • -n Disable DNS resolution.


                                    • -iL Input file name.

                                    Other interesting options in case you want to ping a really large number of targets:




                                    • -T4 Increase timing to reduce scan duration.


                                    • --min-parallelism 100 Increase number of parallel probes.


                                    • -oG <file> Write scan results to file in Grepable format.

                                    Without creating a file



                                    Keep in mind that you can also forgo the creation of a file and use a - to take input from either a pipe, |, or via traditional methods for redirecting output via STDIN.



                                    Examples:



                                    $ ( echo www.google.com; echo www.yahoo.com ) | sudo nmap -sn -n -iL -


                                    -or-



                                    $ sudo nmap -sn -n -iL - < <(echo www.google.com; echo www.yahoo.com)


                                    -or-



                                    $ sudo nmap -sn -n -iL - <<< $'www.google.comnwww.yahoo.com'


                                    References



                                    • Target Specification - Chapter 15. Nmap Reference Guide





                                    share|improve this answer
































                                      2


















                                      Nmap supports ping scans (ICMP) and multiple hosts:



                                      nmap -sn -n 127.0.0.1 8.8.8.8



                                      You can also create a file containing all of your target IPs (separated by spaces or newlines) called targets.txt. Then run:



                                      nmap -sn -n -iL targets.txt



                                      Options explained:




                                      • -sn Ping Scan.


                                      • -n Disable DNS resolution.


                                      • -iL Input file name.

                                      Other interesting options in case you want to ping a really large number of targets:




                                      • -T4 Increase timing to reduce scan duration.


                                      • --min-parallelism 100 Increase number of parallel probes.


                                      • -oG <file> Write scan results to file in Grepable format.

                                      Without creating a file



                                      Keep in mind that you can also forgo the creation of a file and use a - to take input from either a pipe, |, or via traditional methods for redirecting output via STDIN.



                                      Examples:



                                      $ ( echo www.google.com; echo www.yahoo.com ) | sudo nmap -sn -n -iL -


                                      -or-



                                      $ sudo nmap -sn -n -iL - < <(echo www.google.com; echo www.yahoo.com)


                                      -or-



                                      $ sudo nmap -sn -n -iL - <<< $'www.google.comnwww.yahoo.com'


                                      References



                                      • Target Specification - Chapter 15. Nmap Reference Guide





                                      share|improve this answer






























                                        2














                                        2










                                        2









                                        Nmap supports ping scans (ICMP) and multiple hosts:



                                        nmap -sn -n 127.0.0.1 8.8.8.8



                                        You can also create a file containing all of your target IPs (separated by spaces or newlines) called targets.txt. Then run:



                                        nmap -sn -n -iL targets.txt



                                        Options explained:




                                        • -sn Ping Scan.


                                        • -n Disable DNS resolution.


                                        • -iL Input file name.

                                        Other interesting options in case you want to ping a really large number of targets:




                                        • -T4 Increase timing to reduce scan duration.


                                        • --min-parallelism 100 Increase number of parallel probes.


                                        • -oG <file> Write scan results to file in Grepable format.

                                        Without creating a file



                                        Keep in mind that you can also forgo the creation of a file and use a - to take input from either a pipe, |, or via traditional methods for redirecting output via STDIN.



                                        Examples:



                                        $ ( echo www.google.com; echo www.yahoo.com ) | sudo nmap -sn -n -iL -


                                        -or-



                                        $ sudo nmap -sn -n -iL - < <(echo www.google.com; echo www.yahoo.com)


                                        -or-



                                        $ sudo nmap -sn -n -iL - <<< $'www.google.comnwww.yahoo.com'


                                        References



                                        • Target Specification - Chapter 15. Nmap Reference Guide





                                        share|improve this answer
















                                        Nmap supports ping scans (ICMP) and multiple hosts:



                                        nmap -sn -n 127.0.0.1 8.8.8.8



                                        You can also create a file containing all of your target IPs (separated by spaces or newlines) called targets.txt. Then run:



                                        nmap -sn -n -iL targets.txt



                                        Options explained:




                                        • -sn Ping Scan.


                                        • -n Disable DNS resolution.


                                        • -iL Input file name.

                                        Other interesting options in case you want to ping a really large number of targets:




                                        • -T4 Increase timing to reduce scan duration.


                                        • --min-parallelism 100 Increase number of parallel probes.


                                        • -oG <file> Write scan results to file in Grepable format.

                                        Without creating a file



                                        Keep in mind that you can also forgo the creation of a file and use a - to take input from either a pipe, |, or via traditional methods for redirecting output via STDIN.



                                        Examples:



                                        $ ( echo www.google.com; echo www.yahoo.com ) | sudo nmap -sn -n -iL -


                                        -or-



                                        $ sudo nmap -sn -n -iL - < <(echo www.google.com; echo www.yahoo.com)


                                        -or-



                                        $ sudo nmap -sn -n -iL - <<< $'www.google.comnwww.yahoo.com'


                                        References



                                        • Target Specification - Chapter 15. Nmap Reference Guide






                                        share|improve this answer















                                        share|improve this answer




                                        share|improve this answer








                                        edited Jun 17 at 11:41









                                        slm

                                        272k77 gold badges591 silver badges735 bronze badges




                                        272k77 gold badges591 silver badges735 bronze badges










                                        answered Jun 17 at 9:57









                                        scaiscai

                                        7,5052 gold badges19 silver badges35 bronze badges




                                        7,5052 gold badges19 silver badges35 bronze badges
























                                            2


















                                            By using the common xargs command to build an execute multiple ping requests:



                                            echo host1 host2 host3 | xargs -n1 -P0 ping -c 4


                                            Where host1 host2 host3 can be a variable number of hosts (any combination of IP or hostname).



                                            This alters the xargs defaults to force 1 input argument per ping execution, and allow an unlimited number of parallel child processes (1 per pinged host). It is probably wise to set -P (aka --max-procs) to a sane value if intending to ping a large number of hosts (they'll all be processed; just fewer simultaneously).



                                            Its short enough to use directly, could be added as a function to your shell profile or rc file, or turned into tiny script in your $PATH. In the examples below, -P has been set to 10 to avoid excessive resource consumption.



                                            Example script: /usr/bin/mping



                                            #!/bin/sh

                                            echo $@ | xargs -n1 -P10 ping -c4


                                            Example function within ~/.bashrc



                                            function mping() 
                                            echo $@


                                            And use as:



                                            mping host1 host2 host3 ...





                                            share|improve this answer





















                                            • 1





                                              You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

                                              – Criggie
                                              Jun 18 at 0:22






                                            • 1





                                              Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

                                              – Jason Musgrove
                                              Jun 18 at 7:37















                                            2


















                                            By using the common xargs command to build an execute multiple ping requests:



                                            echo host1 host2 host3 | xargs -n1 -P0 ping -c 4


                                            Where host1 host2 host3 can be a variable number of hosts (any combination of IP or hostname).



                                            This alters the xargs defaults to force 1 input argument per ping execution, and allow an unlimited number of parallel child processes (1 per pinged host). It is probably wise to set -P (aka --max-procs) to a sane value if intending to ping a large number of hosts (they'll all be processed; just fewer simultaneously).



                                            Its short enough to use directly, could be added as a function to your shell profile or rc file, or turned into tiny script in your $PATH. In the examples below, -P has been set to 10 to avoid excessive resource consumption.



                                            Example script: /usr/bin/mping



                                            #!/bin/sh

                                            echo $@ | xargs -n1 -P10 ping -c4


                                            Example function within ~/.bashrc



                                            function mping() 
                                            echo $@


                                            And use as:



                                            mping host1 host2 host3 ...





                                            share|improve this answer





















                                            • 1





                                              You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

                                              – Criggie
                                              Jun 18 at 0:22






                                            • 1





                                              Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

                                              – Jason Musgrove
                                              Jun 18 at 7:37













                                            2














                                            2










                                            2









                                            By using the common xargs command to build an execute multiple ping requests:



                                            echo host1 host2 host3 | xargs -n1 -P0 ping -c 4


                                            Where host1 host2 host3 can be a variable number of hosts (any combination of IP or hostname).



                                            This alters the xargs defaults to force 1 input argument per ping execution, and allow an unlimited number of parallel child processes (1 per pinged host). It is probably wise to set -P (aka --max-procs) to a sane value if intending to ping a large number of hosts (they'll all be processed; just fewer simultaneously).



                                            Its short enough to use directly, could be added as a function to your shell profile or rc file, or turned into tiny script in your $PATH. In the examples below, -P has been set to 10 to avoid excessive resource consumption.



                                            Example script: /usr/bin/mping



                                            #!/bin/sh

                                            echo $@ | xargs -n1 -P10 ping -c4


                                            Example function within ~/.bashrc



                                            function mping() 
                                            echo $@


                                            And use as:



                                            mping host1 host2 host3 ...





                                            share|improve this answer














                                            By using the common xargs command to build an execute multiple ping requests:



                                            echo host1 host2 host3 | xargs -n1 -P0 ping -c 4


                                            Where host1 host2 host3 can be a variable number of hosts (any combination of IP or hostname).



                                            This alters the xargs defaults to force 1 input argument per ping execution, and allow an unlimited number of parallel child processes (1 per pinged host). It is probably wise to set -P (aka --max-procs) to a sane value if intending to ping a large number of hosts (they'll all be processed; just fewer simultaneously).



                                            Its short enough to use directly, could be added as a function to your shell profile or rc file, or turned into tiny script in your $PATH. In the examples below, -P has been set to 10 to avoid excessive resource consumption.



                                            Example script: /usr/bin/mping



                                            #!/bin/sh

                                            echo $@ | xargs -n1 -P10 ping -c4


                                            Example function within ~/.bashrc



                                            function mping() 
                                            echo $@


                                            And use as:



                                            mping host1 host2 host3 ...






                                            share|improve this answer













                                            share|improve this answer




                                            share|improve this answer










                                            answered Jun 17 at 16:01









                                            Jason MusgroveJason Musgrove

                                            4953 silver badges5 bronze badges




                                            4953 silver badges5 bronze badges










                                            • 1





                                              You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

                                              – Criggie
                                              Jun 18 at 0:22






                                            • 1





                                              Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

                                              – Jason Musgrove
                                              Jun 18 at 7:37












                                            • 1





                                              You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

                                              – Criggie
                                              Jun 18 at 0:22






                                            • 1





                                              Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

                                              – Jason Musgrove
                                              Jun 18 at 7:37







                                            1




                                            1





                                            You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

                                            – Criggie
                                            Jun 18 at 0:22





                                            You might consider using -w 2 to make ping wait no longer than 2 seconds. The default is 10 seconds, which is per-invocation of ping, so this could take 30+ seconds to complete.

                                            – Criggie
                                            Jun 18 at 0:22




                                            1




                                            1





                                            Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

                                            – Jason Musgrove
                                            Jun 18 at 7:37





                                            Yes, that's a good idea if pinging more hosts than you set for --max-procs / -P. However, for host counts less than -P, all of pings are being executed in parallel - which means that it will take as long as the single longest ping execution, rather than the sum of them all.

                                            – Jason Musgrove
                                            Jun 18 at 7:37











                                            1


















                                            I do not know what you want exactly but you could change the last 8 bit-set into the decimal 255, so your hosts will receive a broadcast, actually,it will transmit ping packets to all devices that exist in a network.



                                            ping -c 1 xx.xx.xx.255





                                            share|improve this answer





















                                            • 1





                                              That's not what I'm looking for.

                                              – slm
                                              Jun 14 at 20:38






                                            • 8





                                              Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

                                              – Criggie
                                              Jun 16 at 3:45















                                            1


















                                            I do not know what you want exactly but you could change the last 8 bit-set into the decimal 255, so your hosts will receive a broadcast, actually,it will transmit ping packets to all devices that exist in a network.



                                            ping -c 1 xx.xx.xx.255





                                            share|improve this answer





















                                            • 1





                                              That's not what I'm looking for.

                                              – slm
                                              Jun 14 at 20:38






                                            • 8





                                              Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

                                              – Criggie
                                              Jun 16 at 3:45













                                            1














                                            1










                                            1









                                            I do not know what you want exactly but you could change the last 8 bit-set into the decimal 255, so your hosts will receive a broadcast, actually,it will transmit ping packets to all devices that exist in a network.



                                            ping -c 1 xx.xx.xx.255





                                            share|improve this answer














                                            I do not know what you want exactly but you could change the last 8 bit-set into the decimal 255, so your hosts will receive a broadcast, actually,it will transmit ping packets to all devices that exist in a network.



                                            ping -c 1 xx.xx.xx.255






                                            share|improve this answer













                                            share|improve this answer




                                            share|improve this answer










                                            answered Jun 14 at 20:37









                                            CriticalSYSCriticalSYS

                                            311 bronze badge




                                            311 bronze badge










                                            • 1





                                              That's not what I'm looking for.

                                              – slm
                                              Jun 14 at 20:38






                                            • 8





                                              Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

                                              – Criggie
                                              Jun 16 at 3:45












                                            • 1





                                              That's not what I'm looking for.

                                              – slm
                                              Jun 14 at 20:38






                                            • 8





                                              Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

                                              – Criggie
                                              Jun 16 at 3:45







                                            1




                                            1





                                            That's not what I'm looking for.

                                            – slm
                                            Jun 14 at 20:38





                                            That's not what I'm looking for.

                                            – slm
                                            Jun 14 at 20:38




                                            8




                                            8





                                            Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

                                            – Criggie
                                            Jun 16 at 3:45





                                            Welcome to the site - This is a good thought and shows an understanding of the Broadcast IP and its purpose in an IP network, and is completely correct. However it doesn't match OP's specific requirement in this narrowly-defined case. Do please carry on and have a crack at answering other questions.

                                            – Criggie
                                            Jun 16 at 3:45











                                            0


















                                            ping google.com && ping localhost


                                            Output



                                            Pinging google.com [xxxxxxx] with 32 bytes of data:
                                            Reply from xxxxxxx: bytes=32 time=210ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=212ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=211ms TTL=49
                                            Reply from ::1: time<1ms





                                            share|improve this answer


























                                            • Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

                                              – Criggie
                                              Jun 18 at 0:24















                                            0


















                                            ping google.com && ping localhost


                                            Output



                                            Pinging google.com [xxxxxxx] with 32 bytes of data:
                                            Reply from xxxxxxx: bytes=32 time=210ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=212ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=211ms TTL=49
                                            Reply from ::1: time<1ms





                                            share|improve this answer


























                                            • Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

                                              – Criggie
                                              Jun 18 at 0:24













                                            0














                                            0










                                            0









                                            ping google.com && ping localhost


                                            Output



                                            Pinging google.com [xxxxxxx] with 32 bytes of data:
                                            Reply from xxxxxxx: bytes=32 time=210ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=212ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=211ms TTL=49
                                            Reply from ::1: time<1ms





                                            share|improve this answer














                                            ping google.com && ping localhost


                                            Output



                                            Pinging google.com [xxxxxxx] with 32 bytes of data:
                                            Reply from xxxxxxx: bytes=32 time=210ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=212ms TTL=49
                                            Reply from ::1: time<1ms
                                            Reply from xxxxxxx: bytes=32 time=211ms TTL=49
                                            Reply from ::1: time<1ms






                                            share|improve this answer













                                            share|improve this answer




                                            share|improve this answer










                                            answered Jun 17 at 8:19









                                            ManishManish

                                            101




                                            101















                                            • Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

                                              – Criggie
                                              Jun 18 at 0:24

















                                            • Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

                                              – Criggie
                                              Jun 18 at 0:24
















                                            Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

                                            – Criggie
                                            Jun 18 at 0:24





                                            Downsides of this are 1) that && operator only allows the second command to run if the first command completed successfully, (ie an exit code of 0) And 2) the first ping will never end without a ^C to interrupt it. Consider adding a -c and a -w parameter. Welcome to the site!

                                            – Criggie
                                            Jun 18 at 0:24











                                            -1


















                                            Just for fun and profit...



                                            #!/bin/sh -

                                            # sends six "pings" to a list of hosts defined in "hosts" below

                                            hosts="
                                            host.a
                                            host.b
                                            host.c
                                            host.d
                                            host.e
                                            "

                                            for p in $hosts
                                            do
                                            # ONLY CHOOSE ONE OF THE FOLLOWING, NOT BOTH
                                            # dump results to file
                                            ping -c 6 $p >>./PINGED
                                            # dump output to console
                                            ping -c 6 $p
                                            done

                                            exit


                                            This could be easily enhanced. Which makes it pretty useful. :)



                                            For additional options please see the man pages for bsd ping and Linux ping



                                            HTH



                                            EDIT: slightly updated to terminate the ping queries @6 pings each, and add man page options.






                                            share|improve this answer




























                                            • The first ping call never returns unless it hits a fatal error.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:14











                                            • Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

                                              – somebody
                                              Jun 15 at 9:28






                                            • 2





                                              Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:43












                                            • Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

                                              – somebody
                                              Jun 15 at 9:49






                                            • 1





                                              What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

                                              – somebody
                                              Jun 16 at 9:59
















                                            -1


















                                            Just for fun and profit...



                                            #!/bin/sh -

                                            # sends six "pings" to a list of hosts defined in "hosts" below

                                            hosts="
                                            host.a
                                            host.b
                                            host.c
                                            host.d
                                            host.e
                                            "

                                            for p in $hosts
                                            do
                                            # ONLY CHOOSE ONE OF THE FOLLOWING, NOT BOTH
                                            # dump results to file
                                            ping -c 6 $p >>./PINGED
                                            # dump output to console
                                            ping -c 6 $p
                                            done

                                            exit


                                            This could be easily enhanced. Which makes it pretty useful. :)



                                            For additional options please see the man pages for bsd ping and Linux ping



                                            HTH



                                            EDIT: slightly updated to terminate the ping queries @6 pings each, and add man page options.






                                            share|improve this answer




























                                            • The first ping call never returns unless it hits a fatal error.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:14











                                            • Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

                                              – somebody
                                              Jun 15 at 9:28






                                            • 2





                                              Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:43












                                            • Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

                                              – somebody
                                              Jun 15 at 9:49






                                            • 1





                                              What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

                                              – somebody
                                              Jun 16 at 9:59














                                            -1














                                            -1










                                            -1









                                            Just for fun and profit...



                                            #!/bin/sh -

                                            # sends six "pings" to a list of hosts defined in "hosts" below

                                            hosts="
                                            host.a
                                            host.b
                                            host.c
                                            host.d
                                            host.e
                                            "

                                            for p in $hosts
                                            do
                                            # ONLY CHOOSE ONE OF THE FOLLOWING, NOT BOTH
                                            # dump results to file
                                            ping -c 6 $p >>./PINGED
                                            # dump output to console
                                            ping -c 6 $p
                                            done

                                            exit


                                            This could be easily enhanced. Which makes it pretty useful. :)



                                            For additional options please see the man pages for bsd ping and Linux ping



                                            HTH



                                            EDIT: slightly updated to terminate the ping queries @6 pings each, and add man page options.






                                            share|improve this answer
















                                            Just for fun and profit...



                                            #!/bin/sh -

                                            # sends six "pings" to a list of hosts defined in "hosts" below

                                            hosts="
                                            host.a
                                            host.b
                                            host.c
                                            host.d
                                            host.e
                                            "

                                            for p in $hosts
                                            do
                                            # ONLY CHOOSE ONE OF THE FOLLOWING, NOT BOTH
                                            # dump results to file
                                            ping -c 6 $p >>./PINGED
                                            # dump output to console
                                            ping -c 6 $p
                                            done

                                            exit


                                            This could be easily enhanced. Which makes it pretty useful. :)



                                            For additional options please see the man pages for bsd ping and Linux ping



                                            HTH



                                            EDIT: slightly updated to terminate the ping queries @6 pings each, and add man page options.







                                            share|improve this answer















                                            share|improve this answer




                                            share|improve this answer








                                            edited Jun 16 at 10:07

























                                            answered Jun 14 at 20:18









                                            somebodysomebody

                                            2845 bronze badges




                                            2845 bronze badges















                                            • The first ping call never returns unless it hits a fatal error.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:14











                                            • Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

                                              – somebody
                                              Jun 15 at 9:28






                                            • 2





                                              Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:43












                                            • Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

                                              – somebody
                                              Jun 15 at 9:49






                                            • 1





                                              What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

                                              – somebody
                                              Jun 16 at 9:59


















                                            • The first ping call never returns unless it hits a fatal error.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:14











                                            • Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

                                              – somebody
                                              Jun 15 at 9:28






                                            • 2





                                              Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

                                              – Gilles 'SO- stop being evil'
                                              Jun 15 at 9:43












                                            • Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

                                              – somebody
                                              Jun 15 at 9:49






                                            • 1





                                              What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

                                              – somebody
                                              Jun 16 at 9:59

















                                            The first ping call never returns unless it hits a fatal error.

                                            – Gilles 'SO- stop being evil'
                                            Jun 15 at 9:14





                                            The first ping call never returns unless it hits a fatal error.

                                            – Gilles 'SO- stop being evil'
                                            Jun 15 at 9:14













                                            Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

                                            – somebody
                                            Jun 15 at 9:28





                                            Really? I tested this before posting it here, and it worked as described. You do know that not every host will respond to being pinged. Perhaps the hosts you queried weren't responding. In any case. In an effort to provide quicker feedback, I've limited the queries to 6 requests per host.

                                            – somebody
                                            Jun 15 at 9:28




                                            2




                                            2





                                            Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

                                            – Gilles 'SO- stop being evil'
                                            Jun 15 at 9:43






                                            Now at least the script has a chance of terminating in practice. But without parallelism, it's still pretty useless. If the first host responds, the user doesn't get any information about the other hosts for the first 5 seconds.

                                            – Gilles 'SO- stop being evil'
                                            Jun 15 at 9:43














                                            Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

                                            – somebody
                                            Jun 15 at 9:49





                                            Well this was intended to be more of an example to build upon, as one needs. I could easily create another that fully saturates your pipe. But is that what you're really after? :)

                                            – somebody
                                            Jun 15 at 9:49




                                            1




                                            1





                                            What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

                                            – somebody
                                            Jun 16 at 9:59






                                            What I should have done is to create a link to the ping man page. Honestly. I only created it as an easy template for one to easily modify for their own means. ping works drastically different on different OS's, and under the myriad of different network conditions that each individual may be working under. So there is no "perfect" default for everyone. Each has their own "sweet spot". :) Did I mention that it works perfectly for me? ;)

                                            – somebody
                                            Jun 16 at 9:59












                                            -2


















                                            Use below simple command:



                                            $ getip() tr -d '()' 2>&1 




                                            $ getip 'hostname.number1.net'
                                            $ getip 'hostname.number2.net'
                                            $ getip 'hostname.number3.net'
                                            $ getip 'hostname.number4.net'
                                            $ getip 'hostname.number5.net'
                                            $ getip 'hostname.number6.net'
                                            $ getip 'hostname.number7.net'
                                            $ getip 'hostname.number8.net'




                                            $ cat /tmp/result.log
                                            ABC.DEF.GHI.XY1
                                            ABC.DEF.GHI.XY2
                                            ABC.DEF.GHI.XY3
                                            ABC.DEF.GHI.XY4
                                            ABC.DEF.GHI.XY5
                                            ABC.DEF.GHI.XY6
                                            ABC.DEF.GHI.XY7
                                            ABC.DEF.GHI.XY8





                                            share|improve this answer
































                                              -2


















                                              Use below simple command:



                                              $ getip() tr -d '()' 2>&1 




                                              $ getip 'hostname.number1.net'
                                              $ getip 'hostname.number2.net'
                                              $ getip 'hostname.number3.net'
                                              $ getip 'hostname.number4.net'
                                              $ getip 'hostname.number5.net'
                                              $ getip 'hostname.number6.net'
                                              $ getip 'hostname.number7.net'
                                              $ getip 'hostname.number8.net'




                                              $ cat /tmp/result.log
                                              ABC.DEF.GHI.XY1
                                              ABC.DEF.GHI.XY2
                                              ABC.DEF.GHI.XY3
                                              ABC.DEF.GHI.XY4
                                              ABC.DEF.GHI.XY5
                                              ABC.DEF.GHI.XY6
                                              ABC.DEF.GHI.XY7
                                              ABC.DEF.GHI.XY8





                                              share|improve this answer






























                                                -2














                                                -2










                                                -2









                                                Use below simple command:



                                                $ getip() tr -d '()' 2>&1 




                                                $ getip 'hostname.number1.net'
                                                $ getip 'hostname.number2.net'
                                                $ getip 'hostname.number3.net'
                                                $ getip 'hostname.number4.net'
                                                $ getip 'hostname.number5.net'
                                                $ getip 'hostname.number6.net'
                                                $ getip 'hostname.number7.net'
                                                $ getip 'hostname.number8.net'




                                                $ cat /tmp/result.log
                                                ABC.DEF.GHI.XY1
                                                ABC.DEF.GHI.XY2
                                                ABC.DEF.GHI.XY3
                                                ABC.DEF.GHI.XY4
                                                ABC.DEF.GHI.XY5
                                                ABC.DEF.GHI.XY6
                                                ABC.DEF.GHI.XY7
                                                ABC.DEF.GHI.XY8





                                                share|improve this answer
















                                                Use below simple command:



                                                $ getip() tr -d '()' 2>&1 




                                                $ getip 'hostname.number1.net'
                                                $ getip 'hostname.number2.net'
                                                $ getip 'hostname.number3.net'
                                                $ getip 'hostname.number4.net'
                                                $ getip 'hostname.number5.net'
                                                $ getip 'hostname.number6.net'
                                                $ getip 'hostname.number7.net'
                                                $ getip 'hostname.number8.net'




                                                $ cat /tmp/result.log
                                                ABC.DEF.GHI.XY1
                                                ABC.DEF.GHI.XY2
                                                ABC.DEF.GHI.XY3
                                                ABC.DEF.GHI.XY4
                                                ABC.DEF.GHI.XY5
                                                ABC.DEF.GHI.XY6
                                                ABC.DEF.GHI.XY7
                                                ABC.DEF.GHI.XY8






                                                share|improve this answer















                                                share|improve this answer




                                                share|improve this answer








                                                edited Sep 30 at 12:22









                                                αғsнιη

                                                19.1k11 gold badges36 silver badges73 bronze badges




                                                19.1k11 gold badges36 silver badges73 bronze badges










                                                answered Sep 30 at 7:56









                                                Kevin LiKevin Li

                                                95




                                                95































                                                    draft saved

                                                    draft discarded















































                                                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid


                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.

                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function ()
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f524963%2fhow-can-i-ping-multiple-ip-addresses-at-the-same-time%23new-answer', 'question_page');

                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown









                                                    Popular posts from this blog

                                                    Tamil (spriik) Luke uk diar | Nawigatjuun

                                                    Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                                                    Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?