6

Users often seem confused about what Pi model they have and what OS version is installed or how to find details.

Where is this located?

3
14

To list the initial installation (Raspbian only) cat /etc/rpi-issue | grep reference

Raspberry Pi reference 2019-06-20

To list the Current OS lsb_release -irdc

Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster

To list the Kernel version uname -r

4.19.58-v7l+

To list the Model cat /proc/device-tree/model

Raspberry Pi 4 Model B Rev 1.1

There are a number of other interesting data:-

To list the hostname hostname

MilliwaysPi4

To list the Firmware /opt/vc/bin/vcgencmd version

Jul  9 2019 14:37:58 
Copyright (c) 2012 Broadcom
version d2b1b7fb01475cb3914b2086299e32d724e832f1 (clean) (release) (start)

To list the date the File System was "created" sudo tune2fs -l /dev/mmcblk0p2 | grep created (only for Raspbian on SD Card, but could be modified for other)

Filesystem created:       Fri Jun 21 03:05:22 2019

The following script is one I use including the above commands to collect relevant details. (It is called about)

The following is an updated script - including Architecture, IP and SSID

#! /bin/sh
# 2021-03-06    print_head; simplified Firmware; Architecture

# Function to print coloured headings
#  delete "tput" lines for plain output
print_head () {
 tput setaf 6
 echo $1
 tput sgr 0
}

if [ -e /etc/rpi-issue ]; then
 print_head "- Original Installation"
 cat /etc/rpi-issue | grep reference
fi

if [ -e /usr/bin/lsb_release ]; then
 print_head "- Current OS"
 lsb_release -irdc
fi
if [ ! -e /usr/share/xsessions ]; then
    print_head "X NOT installed"
fi
print_head "- Kernel"
uname -r
print_head "- Architecture"
uname -m

print_head "- Model"
cat /proc/device-tree/model && echo

print_head "- hostname"
hostname
hostname -I

sudo fdisk -l /dev/mmcblk0 | grep "Disk identifier"

if [ -e /opt/vc/bin/vcgencmd -o /usr/bin/vcgencmd ]; then
    VERS=$(vcgencmd version  | grep ":")
    print_head "- Firmware"
    echo $VERS
fi
print_head "- Created"
sudo tune2fs -l $(mount -v | awk '/ on \/ / {print $1}') | grep created

Output on Raspberry Pi OS (64bit) Pi4B

- Original Installation
Raspberry Pi reference 2020-08-20
- Current OS
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:   buster
- Kernel
5.10.17-v8+
- Architecture
aarch64
- Model
Raspberry Pi 4 Model B Rev 1.1
- hostname
MilliwaysPi4
10.1.2.74 10.1.2.84 
Disk identifier: 0x0d311029
- Firmware
Feb 25 2021 12:10:40
- Created
Filesystem created:       Thu Aug 20 21:58:06 2020

The output on my Pi3A+ shows

- Original Installation
Raspberry Pi reference 2019-07-10
- Current OS
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster
X NOT installed
- Kernel
5.4.72-v7+
- Architecture
armv7l
- Model
Raspberry Pi 3 Model A Plus Rev 1.0
- hostname
MilliwaysPi3A
10.1.2.93 
Disk identifier: 0xb5d2de0f
- Firmware
Oct 22 2020 14:06:02
- Created
Filesystem created:       Wed Jul 10 10:20:54 2019
1
  • Reminds me of the old SysInternals windows program bginfo - tempted to create a little Python program to hack the desktop :-). Bookmarked.
    – user115418
    Mar 24 '20 at 15:02
2

A "quick and dirty" answer to the question follows. All can be entered from the command line interface:

  1. cat /etc/os-release # provides NAMES, VERSIONS & some URLs for support

  2. lsb_release -a # distribution-specific information; ref man lsb_release

  3. hostnamectl # brief & useful incl hostname, OS ver, kernel ver; ref man hostnamectl

And as if you needed more, this command provides a terse summary with several options to get a specific item - which is useful in scripts to check version dependencies, etc. See man uname for details, and for example, the kernel version can be had as follows:

  1. uname -r

Credits to nixCraft for the most complete answer I could find.

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.