How to Find Your Raspberry Pi in Your Network Using Nmap

Bildschirmfoto 2016-09-09 um 09.01.26

sudo nmap -sn | grep -B 2 Raspberry

First you have to find your current IP address and netmask. If you don’t know what a netmask is, chances are you have a 24-bit netmask (which you may have seen in this format:

The -sn option in nmap disables port scanning. This allows for a much faster, host discovery-only scan. After nmap is done, we are piping its output into grep, so that we can filter out our Raspberry Pi devices. The -B option stands for “before”, which means that grep will include the upper two lines of the output too. Without them we would only see the MAC address.

If you put this command in our ~/.bash_profile file with an alias, we can simply type “findpi” into a terminal and are done (see screenshot above)!

alias findpi='sudo nmap -sn | grep -B 2 Raspberry'

Leave a Reply

Your email address will not be published. Required fields are marked *