102

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 4:45
4
uname -a

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

man uname
  • 24
    The question was about the distro version, not the kernel version, so this answer is really not useful. – slikts Aug 29 '15 at 20:19
  • 2
    I can't help it if he chose to accept the wrong answer. Perhaps it gave him what he needed. – recantha Sep 2 '15 at 15:24
  • 1
    uname -a displays Linux raspberrypi 4.4.32-v7+ #924 SMP Tue Nov 15 18:11:28 GMT 2016 armv7l GNU/Linux. However, I need to know if the Pi is running Debian 7 or Debian 8. – IgorGanapolsky Nov 27 '16 at 21:37
  • Need to know Jessie vs Stretch... – SDsolar Jul 9 '18 at 0:08
  • 2
    See correct answer, below: cat /etc/os-release, thanks to @w5m – Nick May Feb 24 at 3:56
247

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"
  • 15
    This answer clearly displayed what version of Raspbian I am running, unlike the chosen answer. – ThN May 20 '16 at 15:23
  • 8
    this should be the accepted answer! – Vladislavs Dovgalecs Sep 20 '17 at 0:27
  • 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 9:33
20

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
  • 2
    This is the right answer. – slikts Aug 29 '15 at 20:17
  • 13
    I don't think this is a good answer. Install another app just to give what you can get for free with cat /etc/os-release or cat /etc/*-release is not good – fcm Jan 9 '16 at 23:48
  • 2
    It is an answer and is perfectly valid for the Raspbian distro which is derived from Debian which aims for compliance with the Linux Standards Base. – SlySven Jan 10 '16 at 4:41
  • 1
    It may be the right answer but not the most useful one. – Chiwda Apr 17 '17 at 5:05
19

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
  • 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 9:39
  • +1 because this gives the exact release - there are several different releases of e.g. Jessie – toes Jan 21 at 16:13
2

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

  • 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
0

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)
-1

open terminal and type

cat /proc/version

  • 5
    That will only show kernel version, not distribution version. – Krzysztof Adamski Apr 12 '13 at 6:56

protected by Ghanima Aug 10 '17 at 17:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?