Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active February 7, 2021 21:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellularmitosis/49c520de1d6e81cae2aacde134c3b918 to your computer and use it in GitHub Desktop.
Save cellularmitosis/49c520de1d6e81cae2aacde134c3b918 to your computer and use it in GitHub Desktop.
Identify Raspberry Pi model from the command line

Blog 2020/5/2

<- previous | index | next ->

Identify Raspberry Pi model from the command line

Thanks to the API at perturb.org, this is a one-liner:

$ curl -L perturb.org/rpi?rev=$(awk '/^Revision/ { print $3 }' /proc/cpuinfo)
Revision : a02082
Model    : 3 Model B
Memory   : 1 GB
Overvolt : No
Released : Q1 2016
Notes    : (Mfg by Sony)

See also https://elinux.org/RPi_HardwareHistory

Turn this into a handy script, as /usr/local/bin/pi:

#!/bin/bash
set -e -o pipefail
curl -L perturb.org/rpi?rev=$(awk '/^Revision/ { print $3 }' /proc/cpuinfo)
#!/bin/bash
set -e -o pipefail
curl -L perturb.org/rpi?rev=$(awk '/^Revision/ { print $3 }' /proc/cpuinfo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment