This is a very simple ping script I created to run on a remote UniFi device to scan for other IP addresses on it’s network. It works on SH environments as well as Bash.
Paste the script in a ping.sh file and then
chmod +x ping.sh
run like so, replacing 192.168.1. with the IP range you want to scan.
sh ping.sh 192.168.1.
#!/bin/sh
# simple ping scan utility
# i.e. 192.168.0.
ipFirstPart=$1
ip=0
while [ $ip -ne 255 ]
do
ip=$(($ip+1))
ping -w1 $ipFirstPart${ip} | grep "64 bytes from"
done