I would like to identify which RaspberryPI hardware instance is booting on my network.

I have plans for using a LOT (not just 10) of them as clients in a larger solution, but I would like to reuse the SD-image for them all.

Is there any kinda way to identify them from each other, unless I place somekinda serial code in a file somewhere in the OS?

Btw. I use MONO/C# for programming, but I am just curious to know if the PI has a hardware serialnumber somehow or not?

3 Answers 3


In C# Mono I'm doing this:

private string GetRpiSerial()
    CommandSync("cat /proc/cpuinfo | grep Serial | cut -d ':' -f 2 > /home/pi/serial.txt");

    using (var sr = new StreamReader("/home/pi/serial.txt"))
        return sr.ReadLine().Trim();

public static void CommandSync(string cmd, string args)
    var info = new ProcessStartInfo();
    info.FileName = "/bin/bash";
    info.Arguments = string.Format("-c \"sudo {0} {1}\"", cmd, args);
    info.UseShellExecute = false;
    info.RedirectStandardOutput = true;

    var p = Process.Start(info);

And retrieve anywhere with:

var rpiSerial = GetRpiSerial();
  • This answer is even better than Remo's original answer, as it includes the solution in C# as I originally asked. Very nice of you to produce this one for us all. Apr 16, 2016 at 1:25

You can use the same number used for buying the MPEG license.

Quoting MPEG-2 license key:

To find your serial number, type cat /proc/cpuinfo at the command line as shown below:

pi@raspberrypi:~$ cat /proc/cpuinfo

Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7
Hardware        : BCM2708
Revision        : 1000002
Serial          : 000000000000000d

Serial is what you're looking for.

  • Ahh, nice idea. Do you have any clue of how to retrieve this from Mono? Feb 28, 2013 at 9:25
  • Only problem is that the client/user will have to buy the MPEG license just for that purpose alone. Feb 28, 2013 at 9:26
  • @BerggreenDK. Not sure what you mean. THe serial number that appears with the cpuinfo command is the serial number of the CPU. It's there whether you have an MPEG licence or not.
    – Remo.D
    Feb 28, 2013 at 9:49
  • 1
    No, the '00000...d' is just there as an example. Try doing it on your raspberry and you'll get yours.
    – Remo.D
    Feb 28, 2013 at 10:00
  • 1
    It is an hardware code that is unique for any Raspberry (I have two of them), it is not file based. I would have been surprised if you had it from Virtual Box.
    – Remo.D
    Feb 28, 2013 at 13:20

You could use the MAC address of the ethernet adaptor; use a statement something like this to extract it into a variable:

mysn=`ifconfig eth0 | grep HWaddr |sed -e's/.*HWaddr\s\(\S*\).*/\1/'`
  • A nice suggestion. If I could only see how I should retreive this from MONO. But the idea is great. Had completely forgot to think about the onboard LAN. MAC numbers are enough indeed. Just need to figure out how to pull that information from the System.Net library. Feb 28, 2013 at 9:27
  • Found this: stackoverflow.com/questions/850650/… Feb 28, 2013 at 9:30
  • 1
    Note that you can modify the MAC address of the raspberry. This is a viable solution only if you don't need to be absolutely sure about the identity of your Raspberry Pi. The CPU serial code obtainable with cpuinfo is not alterable.
    – Remo.D
    Feb 28, 2013 at 9:56
  • okay, thats a great point too. Yes, MAC can be changed on some LAN hardware. Thats true. But I am merly concerned that someone would clone my SDCARD and then use it for multiple clients without my knowledge. That would be bad for my architecture of the solution. Feb 28, 2013 at 12:51
  • Sorry @TomG I really appricated your idea and I am going to use it as "fall back" for detecting devices that arent Raspberry PI hardware as my client-programs will be crossplatform. I wish I could mark two answers in this case. Feb 28, 2013 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.