How do you find the Ubuntu version (release number / name) from the command line?


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
  • That works on any LSB compliant distribution, right? I tried it on my debian 6 (squeeze) install, and it worked too. – Warren P Feb 6 '11 at 22:19
  • 1
    Yes. 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 Apr 19 '11 at 20:33
  • lsb_release -rs will provide the version # alone too – JREAM Jul 12 '18 at 9:45
$ cat /etc/issue
Ubuntu 8.10 \n \l
  • 5
    It's worth remembering that /etc/issue may be edited by admins to give a different welcome message.. – Dentrasi Mar 12 '10 at 19:04
  • 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 Feb 6 '11 at 22:20
  • 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 Aug 14 at 5:56

source from /etc/lsb-release to export version information variables into your shell:

$ . /etc/lsb-release

Contains the following variables

$ cat /etc/lsb-release
  • 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 Oct 21 '16 at 12:52
  • 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 Feb 16 '17 at 0:02
  • 1
    I have no lsb_release package installed and I am not sudo. It was useful for me! – Erick M. Sprengel Aug 3 '17 at 17:36

$ 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 Sep 4 '09 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.