There are various Raspberry Pi models. Some of the models looks similar visually. Model can be easily identified by using command line. This tutorial shows how to get a model name of Raspberry Pi.
1. devicetree/base/model file
The /sys/firmware/devicetree/base/model
file contains the model name of the Raspberry Pi. Use the following command to print it:
cat /sys/firmware/devicetree/base/model
Output example:
Raspberry Pi 4 Model B Rev 1.4
The /proc/device-tree
is a symlink to /sys/firmware/devicetree/base
. So, model name can be determined using the /proc/device-tree/model
file as well:
cat /proc/device-tree/model
2. /proc/cpuinfo file
The /proc/cpuinfo
file contains information about the CPUs. It can be used to determine model name of Raspberry Pi.
cat /proc/cpuinfo
Example of a part of the output:
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
.......
Hardware : BCM2711
Revision : d03114
Serial : 100000007184bc7e
Model : Raspberry Pi 4 Model B Rev 1.4
Command to get only model name:
cat /proc/cpuinfo | grep Model | cut -d ':' -f 2 | xargs
In this case, xargs
command is used to trim leading space from output.
Leave a Comment
Cancel reply