110

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?

IQAndreas
  • 10,345
  • 13
    Run lsb_release -a. – Faheem Mitha Jan 03 '15 at 13:01
  • @FaheemMitha There it is: https://gist.github.com/IQAndreas/d7996a6b6f7bee12ec24 (though one of the answers beat you to it by a hair) – IQAndreas Jan 03 '15 at 13:15
  • Possible dupe of http://unix.stackexchange.com/q/6345/4671 – Faheem Mitha Apr 24 '15 at 08:00
  • @FaheemMitha Not a duplicate, that question asks what the version number is. This question is Debian-specific and asks what "version name" is being used. – IQAndreas Apr 24 '15 at 09:40
  • That's basically the same thing. Version number and name (if available) go together. – Faheem Mitha Apr 24 '15 at 09:46
  • @FaheemMitha Not in the case of Debian; none of the commands listed in the "duplicate question's" accepted answer tell me whether I'm running Squeeze or Wheezy. – IQAndreas Apr 25 '15 at 02:00
  • 1
    @IQAndreas I don't use Debian, but based on https://wiki.debian.org/DebianSqueeze and https://wiki.debian.org/DebianWheezy it sure seems like they're in sync. I reopened it since your question is maybe slightly different, but the only different part is "which Debian version is Squeeze and which is Wheezy", which seems pretty easy to resolve unless I'm misunderstanding something – Michael Mrozek Apr 25 '15 at 02:08

4 Answers4

132

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.

Edward
  • 137
PM 2Ring
  • 6,633
  • 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 Jan 03 '15 at 12:58
  • 3
    The last command you edited in (lsb_release -a) tells me it's Wheezy; perfect! – IQAndreas Jan 03 '15 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 Jan 03 '15 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 Jan 03 '15 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 Jan 05 '15 at 01:13
29

To get the exact version number use

cat /etc/debian_version
air4x
  • 391
  • 1
    This does not answer the OP's question of the named version (e.g Wheezy or Jessie) – JoelAZ Oct 11 '17 at 04:25
  • 1
    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 Feb 13 '19 at 00:53
  • This one works in Ubuntu. – d a i s y Feb 20 '19 at 08: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

David
  • 29