Skip to content

Instantly share code, notes, and snippets.

@earljon
Created September 16, 2018 14:07
Show Gist options
  • Save earljon/56cf85adff50d91a8cc31dd2ebc932f6 to your computer and use it in GitHub Desktop.
Save earljon/56cf85adff50d91a8cc31dd2ebc932f6 to your computer and use it in GitHub Desktop.
Find your Raspberry Pi IP Address in your network
#!/bin/bash
# rpi-ip.sh
PI=raspberrypi.local
IPADDR=$(
/sbin/ping -c 1 $PI |
sed -En '1s/^PING [^ ]+ \(([0-9.]+)\): [0-9]+ data bytes$/\1/p'
)
echo "Your Raspberry Pi has an IP Address of $IPADDR"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment