Identify Your Raspberry Pi Hardware via SSH

Not sure which Raspberry Pi model you have? These SSH commands reveal your Pi's model, CPU, RAM, and OS without needing physical access.

I have three Raspberry Pis running headless in various corners of my home. One runs Pi-hole, another handles home automation, and the third… I genuinely forgot what model it is.

Is it a Pi 4 with 2GB or 4GB? Maybe a Pi 3B+? I could unplug it and check the board, but there is an easier way.

If you can SSH into your Pi, you can identify your Raspberry Pi hardware with a few simple commands.

The Quick Answer

Run this command:

cat /sys/firmware/devicetree/base/model

Output:

Raspberry Pi 5 Model B Rev 1.0

That is it. The exact model, variant, and revision in one line.

All the Commands You Need

Here is the complete reference for identifying every aspect of your Pi’s hardware:

Hardware identification commands

Model Identification

Method 1: Device tree (cleanest output)

cat /sys/firmware/devicetree/base/model
Raspberry Pi 5 Model B Rev 1.0

Method 2: CPU info

cat /proc/cpuinfo | grep Model
Model		: Raspberry Pi 5 Model B Rev 1.0

Both give you the same information. The device tree method is slightly cleaner.

Memory (RAM)

free -h
               total        used        free      shared  buff/cache   available
Mem:           7.9Gi       248Mi       7.6Gi        13Mi       153Mi       7.6Gi
Swap:          511Mi          0B       511Mi

The total column under Mem shows your RAM. In this case, 7.9GB indicates an 8GB model (some memory is reserved for the GPU).

Quick RAM check:

DisplayedActual Model
~430MB512MB model
~920MB1GB model
~1.9GB2GB model
~3.7GB4GB model
~7.9GB8GB model

CPU Details

lscpu
Architecture:            aarch64
CPU(s):                  4
Vendor ID:               ARM
Model name:              Cortex-A76
CPU max MHz:             2400.0000
CPU min MHz:             1500.0000

Key fields:

  • Architecture: aarch64 means 64-bit ARM, armv7l means 32-bit
  • Model name: The ARM core type (Cortex-A76 for Pi 5, Cortex-A72 for Pi 4)
  • CPU(s): Number of cores
  • CPU max MHz: Maximum clock speed

Full CPU Info

For the complete picture:

cat /proc/cpuinfo

This outputs detailed information for each CPU core, including:

  • Hardware revision code
  • Serial number
  • Model string

The revision code at the bottom can be decoded using the Raspberry Pi revision codes documentation.

Operating System

lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

Or alternatively:

cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian

The OS version often indicates the Pi’s era:

CodenameDebian VersionRaspberry Pi Era
Bookworm12Pi 4, Pi 5
Bullseye11Pi 4, Pi Zero 2
Buster10Pi 3, Pi 4
Stretch9Pi 2, Pi 3

GPU Memory Allocation

vcgencmd get_mem gpu
gpu=76M

This shows how much RAM is allocated to the GPU. On a Pi 5, the default is typically 76MB.

Quick Reference Script

Here is a one-liner that shows everything at once:

echo "=== Raspberry Pi Hardware Info ===" && \
echo "Model: $(cat /sys/firmware/devicetree/base/model)" && \
echo "RAM: $(free -h | awk '/^Mem:/ {print $2}')" && \
echo "CPU: $(lscpu | grep 'Model name' | cut -d: -f2 | xargs)" && \
echo "Cores: $(nproc)" && \
echo "OS: $(lsb_release -ds 2>/dev/null || cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2 | tr -d '"')"

Output:

=== Raspberry Pi Hardware Info ===
Model: Raspberry Pi 5 Model B Rev 1.0
RAM: 7.9Gi
CPU: Cortex-A76
Cores: 4
OS: Debian GNU/Linux 12 (bookworm)

Save this as pi-info.sh on your Pi for quick future reference:

echo '#!/bin/bash
echo "=== Raspberry Pi Hardware Info ==="
echo "Model: $(cat /sys/firmware/devicetree/base/model)"
echo "RAM: $(free -h | awk '\''/^Mem:/ {print $2}'\'')"
echo "CPU: $(lscpu | grep '\''Model name'\'' | cut -d: -f2 | xargs)"
echo "Cores: $(nproc)"
echo "OS: $(lsb_release -ds 2>/dev/null || cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2 | tr -d '\''"'\'')"' > ~/pi-info.sh && chmod +x ~/pi-info.sh

Then run it anytime with:

~/pi-info.sh

Identifying Pi Models by Specs

If you only have partial information, here is how to identify your Pi:

ModelCPUCoresMax MHzRAM Options
Pi 5Cortex-A76424004GB, 8GB
Pi 4Cortex-A7241500-18001GB, 2GB, 4GB, 8GB
Pi 3B+Cortex-A53414001GB
Pi 3BCortex-A53412001GB
Pi Zero 2 WCortex-A5341000512MB
Pi Zero WARM117611000512MB

When These Commands Do Not Work

“No such file or directory” for device tree:

Older Pi OS images or non-Raspberry Pi OS distributions might not have /sys/firmware/devicetree/base/model. Use /proc/cpuinfo instead.

vcgencmd not found:

Install it with:

sudo apt install libraspberrypi-bin

Or on newer Pi OS versions, it may be at /opt/vc/bin/vcgencmd.

lsb_release not found:

Use cat /etc/os-release instead, or install it:

sudo apt install lsb-release

Summary

What You WantCommand
Model namecat /sys/firmware/devicetree/base/model
RAMfree -h
CPU typelscpu
Full CPU infocat /proc/cpuinfo
OS versionlsb_release -a or cat /etc/os-release
GPU memoryvcgencmd get_mem gpu

Now I know exactly which Pi is running where - without leaving my desk.


This post is part of a series on Raspberry Pi. See also: Raspberry Pi Headless SSH Setup and Keep Your Raspberry Pi Online.

About the Author

Ashish Anand

Ashish Anand

Founder & Lead Developer

Full-stack developer with 10+ years experience in Python, JavaScript, and DevOps. Creator of DevGuide.dev. Previously worked at Microsoft. Specializes in developer tools and automation.