Skip to content

Instantly share code, notes, and snippets.

@ritiek
Last active June 15, 2024 16:12
Show Gist options
  • Save ritiek/08b0ff0e88dc7e5cff6c24b8f032e57e to your computer and use it in GitHub Desktop.
Save ritiek/08b0ff0e88dc7e5cff6c24b8f032e57e to your computer and use it in GitHub Desktop.
Scan for active local IP addresses and resolve their machine names
# Replace "192.168.2.{}" as per your gateway address.
seq 1 254 | xargs -I {} "echo" "192.168.2.{}" | parallel -j 254 "ping -t 1 -c 1 {} > /dev/null && (timeout 1 avahi-resolve -a {} || echo {})" 2> /dev/null | sort -V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment