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?

3
  • 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--
    Commented Apr 24, 2016 at 16:10
  • 1
    @ott--...and Windows 10 IOT. Commented May 20, 2016 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
    Commented Apr 17, 2017 at 4:45

7 Answers 7

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
5
  • 35
    The question was about the distro version, not the kernel version, so this answer is really not useful.
    – slikts
    Commented Aug 29, 2015 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
    Commented Sep 2, 2015 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. Commented Nov 27, 2016 at 21:37
  • 1
    Need to know Jessie vs Stretch...
    – SDsolar
    Commented Jul 9, 2018 at 0:08
  • 4
    See correct answer, below: cat /etc/os-release, thanks to @w5m
    – may
    Commented Feb 24, 2019 at 3:56
315

Use:

cat /etc/apt/sources.list.d/raspi.list

If the file exists, you are using Raspberry Pi OS. An example of the content:

deb http://archive.raspberrypi.com/debian/ bookworm main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.com/debian/ bookworm main

Before Debian 11 (bullseye)

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"
4
  • 21
    This answer clearly displayed what version of Raspbian I am running, unlike the chosen answer.
    – ThN
    Commented May 20, 2016 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
    Commented Jun 14, 2018 at 9:33
  • 1
    this should be the correct answer thank you for this post UPVOTE!
    – MNM
    Commented Nov 28, 2019 at 0:15
  • 1
    definitely the right answer
    – olikaf
    Commented Oct 12, 2020 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
4
  • 2
    This is the right answer.
    – slikts
    Commented Aug 29, 2015 at 20:17
  • 14
    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
    Commented Jan 9, 2016 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
    Commented Jan 10, 2016 at 4:41
  • 1
    It may be the right answer but not the most useful one.
    – Chiwda
    Commented Apr 17, 2017 at 5:05
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
2
  • 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
    Commented Jun 14, 2018 at 9:39
  • +1 because this gives the exact release - there are several different releases of e.g. Jessie
    – toes
    Commented Jan 21, 2019 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

1
  • 2
    When I try this I get: -bash: lsb_release: command not found but this goes away when I install the lsb-release package. Commented Jan 28, 2016 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)
1
  • 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
    Commented Dec 28, 2020 at 9:08
-1

open terminal and type

cat /proc/version

1
  • 5
    That will only show kernel version, not distribution version. Commented Apr 12, 2013 at 6:56