If you don’t have an IP management tool, keeping track of free and used IPs can be a bit of a pain. I’d highly recommend deploying an automated tool such as phpIPAM, but in a pinch Terminal can do the job. When you get a reply from an IP address, it’s (obviously) in use.
For example, if you’re you have a subnet 192.168.5.0/24 here’s how the command would look.
for x in {2..254}; do ping -c 1 -W 100 192.168.5.$x | grep 'time='; done
And here it is in use:
bash-3.2# for x in {1..254}; do ping -c 1 -W 100 192.168.5.$x | grep 'time='; done
64 bytes from 192.168.5.2: icmp_seq=0 ttl=248 time=4.922 ms
64 bytes from 192.168.5.8: icmp_seq=0 ttl=56 time=6.822 ms
64 bytes from 192.168.5.30: icmp_seq=0 ttl=56 time=5.620 ms
64 bytes from 192.168.5.39: icmp_seq=0 ttl=120 time=8.269 ms
64 bytes from 192.168.5.41: icmp_seq=0 ttl=120 time=6.493 ms
64 bytes from 192.168.5.44: icmp_seq=0 ttl=120 time=4.684 ms
64 bytes from 192.168.5.46: icmp_seq=0 ttl=120 time=5.690 ms
64 bytes from 192.168.5.63: icmp_seq=0 ttl=120 time=5.916 ms
64 bytes from 192.168.5.102: icmp_seq=0 ttl=56 time=5.458 ms
bash-3.2#