388 B
388 B
Network monitoring
Discover all devices connected to the local network:
#!/bin/bash
subnet="192.168.0"
for suffix in $(seq 101 199); do
ip_address="$subnet.$suffix"
# Only wait 1 second for each response: ping should only take a few
# milliseconds on LAN.
ping -c 1 -W 1 $ip_address | grep "64 bytes from $ip_address" | awk '{ print $4 }' | sed s/://
done