Category Archives: Linux

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'

Autostart any Script using crontab

This guide is targeted at Raspian (Raspberry Pi) but it will work with most Linux distributions.

First, create your script using your editor of choice. Make sure you know the location of it!



Make it executable:

chmod +x


Now edit your crontab file using this command:

crontab -e


Go to the bottom of the file and add the following line (lines starting with a # will be ignored):

@reboot sh /home/pi/ > /home/pi/superscript-cronlog 2>&1
Tells crontab to execute this command after a boot
Uses sh to execute your script. Of course you can use any other shell too.
Path to your script
Writes the output of your script into the file specified on the right-hand side (green part)
Path to your log file
Makes sure that error messages (stderr) are also written to the log file. More information.


Reboot your computer and it should work!