37
11
How do you find the Ubuntu version (release number / name) from the command line?
37
11
How do you find the Ubuntu version (release number / name) from the command line?
55
Run lsb_release
with the -a
switch.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty
lsb_release -rs
will provide the version # alone too – JREAM – 2018-07-12T09:45:09.420
That works on any LSB compliant distribution, right? I tried it on my debian 6 (squeeze) install, and it worked too. – Warren P – 2011-02-06T22:19:47.643
1Yes. The command 'lsb_release' is from the Linux Standards Base. From the man page; "The lsb_release command provides certain LSB (Linux Standard Base) and distribution-specific information." – jeremiah – 2011-04-19T20:33:52.367
9
$ cat /etc/issue
Ubuntu 8.10 \n \l
5It's worth remembering that /etc/issue may be edited by admins to give a different welcome message.. – Dentrasi – 2010-03-12T19:04:06.480
I have a Docker image where I'm not root
and don't have lsb_release
(and the Ubuntu image it's built on is apparently far up the docker dependency chain), this worked well to suss out which Ubuntu it's running absent lsb_release
. Also, FWIW @WarrenP I'm seeing /etc/debian_version
on this (virtual) machine – MichaelChirico – 2019-08-14T05:56:03.070
This is a useful fallback on non-LSB compliant systems. So is /etc/debian_version (if present), it's a debian based distro. I don't know if Ubuntu leaves the debian_version file there or makes an /etc/Ubuntu_version file though. – Warren P – 2011-02-06T22:20:03.183
0
source
from /etc/lsb-release
to export version information variables into your shell:
$ . /etc/lsb-release
Contains the following variables
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
You shouldn't be using /etc/lsb-release
directly. The spec requires you to query using the lsb_release
command which can query other sources of information. – Michał Górny – 2016-10-21T12:52:06.517
I consider this an appropriate answer until someone bothers to write a command that goes through the lsb_release
command and extracts these. – Adam Griffiths – 2017-02-16T00:02:17.930
1I have no lsb_release package installed and I am not sudo. It was useful for me! – Erick M. Sprengel – 2017-08-03T17:36:43.880
-3
$ uname -a
Linux debian 2.7.30-1-686 #1 SMP Thu May 8 02:16:39 UTC 2008 i686 GNU/Linux
uname -a anaylsis:
Linux: is the kernel name.
debian: is the machine's hostname.
2.7.30-1-686: is the kernel version
1 SMP Thu May 8 02:16:39 UTC 2008: SMP stands for symmetric multiprocessing, denoting that the CPU (central processing unit) is using two or more CPUs and the current system date
i686: is the CPU architecture
GNU/Linux: is OS
8-1, uname doesn't tell you the ubuntu version. lsb_release is the way to go. – ThatGraemeGuy – 2009-09-04T04:20:51.450
Related (cross site): How can I find the version of Ubuntu that is installed?
– Peter Mortensen – 2018-04-07T20:52:12.537