Ping all the hosts in /etc/hosts

By | November 25, 2008

Did you know you can ping all the hosts listed in the /etc/hosts file with one command? Do it with

for i in `grep -v “^#” /etc/hosts | awk ‘{print $1}’`; do ping -c 1 -w 2 $i ; echo; done

Leave a Reply

Your email address will not be published. Required fields are marked *