130

I have been given a pre-installed SD card. It boots fine, and I know it is running some version of Raspbian. Can I determine exactly which release it is running?

  • A note to all answeres: Gnu/Linux may be the favourite OS. But the Rasperry Pi supports other OS like BSD, Plan 9, RISC OS too. – ott-- Apr 24 '16 at 16:10
  • 1
    @ott--...and Windows 10 IOT. – Paul Fleming May 20 '16 at 12:24
  • 2
    @PaulFleming Win 10 IoT? Not really. Not a real OS. You can't do anything on it. You can only run apps created separately (i.e. on a different device/platform) in Visual Studio. – Chiwda Apr 17 '17 at 04:45

7 Answers7

315

Open Terminal and type:

cat /etc/os-release

This results in the following output on my Raspberry Pi 2...

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
w5m
  • 3,251
  • 3
  • 15
  • 8
  • 21
    This answer clearly displayed what version of Raspbian I am running, unlike the chosen answer. – ThN May 20 '16 at 15:23
  • This worked on Stretch on a Pi 2 too. When I ran it tonight on a Virtualbox VM running the latest Raspbian Desktop Stretch (the PC version) it gives Debian for PRETTY_NAME, ID and the *URL values :-( . I'm unsure, seems like an oversight by Raspbian maintainers to me. – mike Jun 14 '18 at 09:33
  • 1
    this should be the correct answer thank you for this post UPVOTE! – MNM Nov 28 '19 at 00:15
  • 1
    definitely the right answer – olikaf Oct 12 '20 at 19:12
26

Do not look at uname -a. That just shows kernel version. To find the distribution version, run:

sudo apt-get install lsb-release
lsb_release -a

My RPi shows:

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.8 (wheezy)
Release:    7.8
Codename:   wheezy
Cerin
  • 2,271
  • 7
  • 31
  • 49
23

https://github.com/RPi-Distro/pi-gen/releases lists releases of Raspbian since 2016-05-10.

To find your Raspbian distribution image release date (not the /etc/os-release information such as VERSION="8 (jessie)") on a running system:

$ cat /etc/rpi-issue
Raspberry Pi reference 2016-05-10
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, c32099002b4c44243e87d8cc90303237eb5ce06a, stage4

Note if you did 'apt-get {dist-,}upgrade' or rpi-update, you will have updated some files since you first installed that distribution image.

[The original poster asked back in 2013, before the github URL existed, but this answer may help some users in 2016.]

Update: Instead of actually running Raspbian on that mysterious Raspbian SD card, you could also mount the SD card in a Linux or Windows desktop SD reader to read the /issue.txt file directly. /issue.txt exists in the root directory of the SD card's FAT16 partition. From Ubuntu 16.04.1, I see the following on a second SD card I have:

Raspberry Pi reference 2016-09-23
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 62406bad92ed23728f46711b3539c04c37dfb62c, stage4
rcpa0
  • 351
  • 2
  • 5
  • This file is present even on the Raspbian Desktop PC ISO image, and since it's generated by pi-gen it seems it's automatically updated, unlike /etc/os-release which it appears is manually edited, and was overlooked on the latest PC image of Raspbian. – mike Jun 14 '18 at 09:39
  • +1 because this gives the exact release - there are several different releases of e.g. Jessie – toes Jan 21 '19 at 16:13
12
uname -a

will give you the kernel version etc. There are some other parameters you could try as well - to see them:

man uname
Ghanima
  • 15,855
  • 15
  • 61
  • 119
recantha
  • 4,489
  • 20
  • 26
2

Almost what Cerin wrote. Just lsb_release -a and you don't need to install the LSB module to see the raspbian description

Arash
  • 129
  • 2
  • 2
    When I try this I get: -bash: lsb_release: command not found but this goes away when I install the lsb-release package. – John S Gruber Jan 28 '16 at 15:29
1

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

You can run this or the individual commands

#! /bin/sh
if [ -e /etc/rpi-issue ]; then
 echo "- Original Installation"
 cat /etc/rpi-issue
fi
if [ -e /usr/bin/lsb_release ]; then
 echo "- Current OS"
 lsb_release -irdc
fi
echo "- Kernel"
uname -r
echo "- Model"
cat /proc/device-tree/model && echo
echo "- hostname"
hostname
echo "- Firmware"
/opt/vc/bin/vcgencmd version

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)
Milliways
  • 59,890
  • 31
  • 101
  • 209
  • Worked on RPi Compute Module 3 Plus Rev 1.0. If you got /bin/sh^M: bad interpreter: No such file or directory please follow this to replace Windows style line endings with Unix style. – Yasindu Dec 28 '20 at 09:08
-1

open terminal and type

cat /proc/version