18

I am connected to 2 Raspberry Pis via SSH. They are running the same OS (Raspbian in this case).

How can I tell which one is Pi 1 and which one is Pi 2?

I know how to identify the physical hardware (e.g. micro SD vs SD slot, yellow video output etc.) but I just don't know which IP address which one got via DHCP.

30

The Raspberry Pi 2 will give BCM2709 hardware and ~1 GB of RAM like this:

pi@raspberrypi:~ $ cat /proc/cpuinfo | grep Hardware
Hardware        : BCM2709
pi@raspberrypi:~ $ cat /proc/meminfo | grep MemTotal
MemTotal:         947756 kB

while the Pi 1 reports BCM2708 hardware and definitely less than 1 GB:

pi@raspberrypi:~ $ cat /proc/cpuinfo | grep Hardware
Hardware        : BCM2708
pi@raspberrypi:~ $ cat /proc/meminfo | grep MemTotal
MemTotal:         445112 kB

To know it in even more detail, use

cat /proc/cpuinfo | grep Revision | awk '{print substr($0, length($0)-3, length($0))}'

where the result can be one of the following:

0002: Pi B Rev 1.0, 256 MB
0003: Pi B Rev 1.0, 256 MB
0004: Pi B Rev 2.0, 256 MB
0005: Pi B Rev 2.0, 256 MB
0006: Pi B Rev 2.0, 256 MB
0007: Pi A
0008: Pi A
0009: Pi A
000d: Pi B Rev 2.0, 512 MB
000e: Pi B Rev 2.0, 512 MB
000f: Pi B Rev 2.0, 512 MB
0010: Pi B+
0012: Pi A+
0013: Pi B+
0015: Pi A+
0092: Pi Zero Rev 1.2
0093: Pi Zero Rev 1.3
1040: Pi 2B Rev 1.0
1041: Pi 2B Rev 1.1
2082: Pi 3B Rev 1.2
8

Additionally to the other answers, if you want to tell more than one pi of the same type apart, you can read the serial number in a similar way:

cat /proc/cpuinfo | grep Serial

Serial          : 000000000000000d

This will be unique per pi.

More info: How do I get the serial number?

7

Or the noob way: poweroff one and identify the IP of the other, then you can guess the other IP.

No matter which way you chose, if you want to go further and distinguish them easily in the future, you can change their hostname once identified.

On each pi do the following:

Edit /etc/hosts file:

sudo nano /etc/hosts

Replace "raspberrypi" in the file with the desired name (ex: raspberrypione).

Edit /etc/hostname file:

sudo nano /etc/hostname

Replace "raspberrypi" in the file with the same name you chose previously.

Then execute sudo /etc/init.d/hostname.sh to commit your changes and reboot sudo reboot

Once you've finished rebooting they will appear on the device list in your router with their new names, so that you can retrieve the IP easily. Plus when you're connected through ssh you'll see their new name in your terminal:

pi@raspberrypione:~ $

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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