4

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?

11

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 IP and SSID (it colours the headings on a terminal to make it easier to read, but the tput commands could be omitted)

#! /bin/sh
# 2019-11-21
if [ -e /etc/rpi-issue ]; then
 tput setaf 6; echo "- Original Installation"; tput sgr 0
 cat /etc/rpi-issue | grep reference
fi

if [ -e /usr/bin/lsb_release ]; then
 tput setaf 6; echo "- Current OS"; tput sgr 0
 lsb_release -irdc
fi
if [ ! -e /usr/share/xsessions ]; then
    tput setaf 1; echo "X NOT installed";tput sgr 0
fi
tput setaf 6; echo "- Kernel"; tput sgr 0
uname -r

echo "- Model"; tput sgr 0
cat /proc/device-tree/model && echo

tput setaf 6; echo "- hostname"; tput sgr 0
hostname
hostname -I
wpa_cli -i wlan0 status | grep -w ssid

tput setaf 6; echo "- Firmware"; tput sgr 0
/opt/vc/bin/vcgencmd version
ROOT_MOUNT=$(mount -v | awk '/ on \/ / {print $1}')
# sudo tune2fs -l /dev/mmcblk0p2 | grep created
sudo tune2fs -l $ROOT_MOUNT | grep created

Output on Pi4B

- Original Installation
Raspberry Pi reference 2019-06-20
- Current OS
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster
- Kernel
4.19.93-v7l+
- Model
Raspberry Pi 4 Model B Rev 1.1
- hostname
MilliwaysPi4
10.1.2.84 
ssid=WiFi-B13A-5G
- Firmware
Jan 10 2020 16:52:04 
Copyright (c) 2012 Broadcom
version fdb5c37e330e7cb3027ac4fcc5b1cd5f244b351f (clean) (release) (start)
Filesystem created:       Mon Sep 16 15:12:26 2019

The output on my Pi3A+ shows

- Original Installation
Raspberry Pi reference 2018-11-13
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 7e0c786c641ba15990b5662f092c106beed40c9f, stage4
- Current OS
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.6 (stretch)
Release:    9.6
Codename:   stretch
- Kernel
4.14.79-v7+
- Model
Raspberry Pi 3 Model A Plus Rev 1.0
- hostname
MilliwaysPi3A
- Firmware
Nov  4 2018 16:31:07 
Copyright (c) 2012 Broadcom
version ed5baf9520a3c4ca82ba38594b898f0c0446da66 (clean) (release)
Filesystem created:       Tue Jan  1 12:09:51 2019

It should produce a meaningful output on most Linux distributions, e.g. Ubuntu MATE

- Current OS
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:    16.04
Codename:   xenial
- Kernel
4.4.38-v7+
- Model
Raspberry Pi 2 Model B Rev 1.1
- hostname
PiUbuntu
- Firmware
Dec  9 2016 15:11:26 
Copyright (c) 2012 Broadcom
version 2e557d8dac70add28597c3b449cb52c34588d818 (clean) (release)
| improve this answer | |
  • Reminds me of the old SysInternals windows program bginfo - tempted to create a little Python program to hack the desktop :-). Bookmarked. – Andyroo Mar 24 at 15:02
1

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.

| improve this answer | |

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.