Tag Archives: ping

Find out active IPs in a Linux LAN

If you are on a LAN and wish to find out which computers in it currently have access to that certain LAN, you can use the following command: for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo “192.168.1.$ip UP” || : ; done This will ping… Read More »

Ping all the hosts in /etc/hosts

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