Files
configs/pve2/root/utilities/pingsweep.sh

11 lines
391 B
Bash

#!/bin/bash
# Scan the local network (192.168.1.0/24) for active hosts using ICMP ping,
# displaying only hosts that respond with their IP address and response time.
for ip in $(seq 1 254); do
ping -c 1 -W 1 192.168.1.$ip | grep "64 bytes" | sed -E "s/^.*from (.*): icmp_seq=1 ttl=.* time=(.*) ms/192.168.1.$(printf '%3d' $ip) \2 ms/" &
done | sort -t. -k1,1n -k2,2n -k3,3n -k4,4n
wait