Find my pi on the local network: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<code> #!/bin/bash # findMYPi: # Find all MY Pi's on the LAN #grep broadcast ip var1=$(ifconfig | grep inet | tail -1 | awk '{print $6}' | cut -f2 -d: | cut -f1-3 -d.) #ping...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<code>
== findMYpi.sh ==
<source lang="bash">
#!/bin/bash
#!/bin/bash
# findMYPi:
# findMYPi.sh:
# Find all MY Pi's on the LAN
# Find all MY Pi's on the LAN


Line 12: Line 13:
#grep MY Pi's
#grep MY Pi's
arp -a | grep "b8:27:eb"
arp -a | grep "b8:27:eb"
</code>
</source>

Latest revision as of 19:16, 7 January 2014

findMYpi.sh

#!/bin/bash
# findMYPi.sh:
# Find all MY Pi's on the LAN

#grep broadcast ip
var1=$(ifconfig | grep inet | tail -1 | awk '{print $6}' | cut -f2 -d: | cut -f1-3 -d.)

#ping all ip's on the network
for i in {1..255}; do ping -c 1 -W 1 $var1.$i; done

#grep MY Pi's
arp -a | grep "b8:27:eb"