• Home
  • About Me
  • Welcome to Short Linux hints
Short hints about Linux


  • Tags

    hacking Linux linux cpanel courier maildir mailbox exim security viruses worms
  • Blogroll

    • Geany
    • Handy one-liners for sed
    • Linux By Example
    • Penguin Tutor

Jun 03

How to check a list of hosts for connectivity issues

Linux Add comments

Imagine you have a big list of hosts called hosts-list. You would like to check if these hosts are pingable.

Here is a sample command which will do it:

for i in `cat hosts-list`; do ping "$i" -c2 2>1 > /dev/null || echo "$i is down"; done

The above pings each entry in the hosts list with 2 packets. If the ping status is not success (0 return code) the host's name is said to be down.

Comments are closed.

Powered by WordPress .::. Designed by SiteGround Web Hosting

cssandhtml