112

In a tutorial, I'm prompted "If you are running Squeeze, follow these instructions..." and "If you are running Wheezy, follow these other instructions..."

When I run uname, I get the following information:

Linux dragon-debian 3.2.0-4-686-pae #1 SMP Debian 3.2.63-2+deb7u2 i686 GNU/Linux

Is that information enough to know if I'm using Squeeze or Wheezy, or do I get that from somewhere else?

7

4 Answers 4

135

Commands to try:

cat /etc/*-release

cat /proc/version

lsb_release -a
- this shows "certain LSB (Linux Standard Base) and distribution-specific information".

For a shell script to get the details on different platforms, there's this related question.

5
  • It's funny you should ask, I just finished writing a related question which I share the outputs of those commands: What is the difference between all of these Debian version numbers? But sadly, none of the outputs say whether I'm using Squeeze or Wheezy.
    – IQAndreas
    Commented Jan 3, 2015 at 12:58
  • 3
    The last command you edited in (lsb_release -a) tells me it's Wheezy; perfect!
    – IQAndreas
    Commented Jan 3, 2015 at 13:02
  • @IQAndreas: Hmmm. It's weird that that you didn't also get that info from cat /etc/*-release on the DISTRIB_CODENAME line. OTOH, I'm not on Debian, I'm on a derived distro, Mepis 11.
    – PM 2Ring
    Commented Jan 3, 2015 at 13:06
  • @IQAndreas As tested on Debian Wheezy, all three provide the Debian version for me: (a) cat /etc/*-release shows Wheezy or, equivalently, version 7, on three separate lines; (b) cat /proc/version shows version number 7 in the suffix to the kernel build; and (c) lsb_release -a shows Wheezy on two lines and version 7 on a third.
    – John1024
    Commented Jan 3, 2015 at 23:50
  • @John1024 "... shows version number in the suffix of the kernel build." - Ah, so that is what deb7u2 meant. From only glancing at it, I assumed it was the Git commit id.
    – IQAndreas
    Commented Jan 5, 2015 at 1:13
30

To get the exact version number use

cat /etc/debian_version
3
  • 1
    This does not answer the OP's question of the named version (e.g Wheezy or Jessie)
    – JoelAZ
    Commented Oct 11, 2017 at 4:25
  • 2
    This answer should be the preferred general answer because it works on distros derived from debian. lsb_release gives the debian version only on debian itself. On Ubuntu 18.10, cat /etc/debian_version gives buster/sid, which is the named debian version I expected.
    – Reece
    Commented Feb 13, 2019 at 0:53
  • This one works in Ubuntu.
    – d a i s y
    Commented Feb 20, 2019 at 8:30
4
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
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"
2

david@asus:/usr/share/applications$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.6 (jessie) Release: 8.6 Codename: jessie

2
  • 4
    What new value does this answer bring compared to the accepted answer?
    – techraf
    Commented Nov 13, 2016 at 8:13
  • 1
    This answer is from a new user, who needs to learn how to write better answers or edit other ones to add useful information.
    – Edward
    Commented Jan 3, 2018 at 21:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .