Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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();
share|improve this answer
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. – BerggreenDK Apr 16 at 1:25

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

Quoting http://www.raspberrypi.com/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.

share|improve this answer
Ahh, nice idea. Do you have any clue of how to retrieve this from Mono? – BerggreenDK Feb 28 '13 at 9:25
Only problem is that the client/user will have to buy the MPEG license just for that purpose alone. – BerggreenDK Feb 28 '13 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 '13 at 9:49
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 '13 at 10:00
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 '13 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/'`
share|improve this answer
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. – BerggreenDK Feb 28 '13 at 9:27
Found this: stackoverflow.com/questions/850650/… – BerggreenDK Feb 28 '13 at 9:30
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 '13 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. – BerggreenDK Feb 28 '13 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. – BerggreenDK Feb 28 '13 at 14:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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