How to check your Ubuntu version from the command line - Rocketeers app

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com/login) 

 On this page

 Knowledge
---------

How to check your Ubuntu version from the command line
======================================================

### [\#CommandLine](https://rocketeersapp.com/knowledge/command-line)

A quick guide to checking which Ubuntu release and kernel you're running, using lsb\_release, /etc/os-release, hostnamectl and uname.

 Published by [Mark van Eijk](https://rocketeersapp.com/author/mark-van-eijk) on June 23, 2026 · 1 minute read

1. [Why you need to know your Ubuntu version](#content-why-you-need-to-know-your-ubuntu-version)
2. [The quickest answer: lsb\_release](#content-the-quickest-answer-lsbrelease)
3. [Reading /etc/os-release](#content-reading-etcos-release)
4. [The old-school /etc/issue](#content-the-old-school-etcissue)
5. [A richer view with hostnamectl](#content-a-richer-view-with-hostnamectl)
6. [Checking the kernel version](#content-checking-the-kernel-version)
7. [Which one should you use?](#content-which-one-should-you-use)

[\#](#content-why-you-need-to-know-your-ubuntu-version "Permalink")Why you need to know your Ubuntu version
-----------------------------------------------------------------------------------------------------------

Before I install a package, follow a tutorial, or open a support ticket, I want to know exactly which Ubuntu release I'm on. The version decides which package versions are available, which docs apply, and whether a release is still getting security updates. Here are the commands I reach for.

[\#](#content-the-quickest-answer-lsbrelease "Permalink")The quickest answer: lsb\_release
------------------------------------------------------------------------------------------

My go-to is `lsb_release`, which prints the distributor info in a clean format:

 ```
lsb_release -a

```

The `-a` flag means "all". You'll get the distributor ID, a description like `Ubuntu 24.04.2 LTS`, the release number (`24.04`), and the codename (`noble`). If you only want the number, use `-r`, and `-c` gives just the codename:

 ```
lsb_release -r
lsb_release -c

```

[\#](#content-reading-etcos-release "Permalink")Reading /etc/os-release
-----------------------------------------------------------------------

`lsb_release` isn't installed on every minimal image, but `/etc/os-release` always is. It's a plain file you can just print:

 ```
cat /etc/os-release

```

This shows `VERSION_ID`, `VERSION_CODENAME`, and `PRETTY_NAME`. Because it's structured as shell variables, scripts can source it directly, which makes it handy in automation.

[\#](#content-the-old-school-etcissue "Permalink")The old-school /etc/issue
---------------------------------------------------------------------------

For a fast glance, `/etc/issue` holds the text shown before login:

 ```
cat /etc/issue

```

It prints something like `Ubuntu 24.04.2 LTS \n \l`. The `\n` and `\l` are placeholders the login prompt fills in, so just ignore them.

[\#](#content-a-richer-view-with-hostnamectl "Permalink")A richer view with hostnamectl
---------------------------------------------------------------------------------------

`hostnamectl` gives the OS plus the hostname, architecture, and kernel in one go:

 ```
hostnamectl

```

I like this one on servers because the "Operating System" and "Kernel" lines tell me almost everything at a glance.

[\#](#content-checking-the-kernel-version "Permalink")Checking the kernel version
---------------------------------------------------------------------------------

The Ubuntu release and the kernel are separate things. To see the running kernel, use `uname`:

 ```
uname -r

```

The `-r` flag prints just the kernel release, like `6.8.0-52-generic`. Want the full picture, including architecture and build date? Use `-a`:

 ```
uname -a

```

[\#](#content-which-one-should-you-use "Permalink")Which one should you use?
----------------------------------------------------------------------------

For everyday use, `lsb_release -a` is the friendliest. On a stripped-down container or cloud image where it's missing, fall back to `cat /etc/os-release`. And when you're chasing a driver or hardware issue, `uname -r` is the kernel detail that actually matters.

Once you know your version, you'll likely want to [update Ubuntu from the command line](/update-ubuntu-command-line) to pull in the latest security patches.

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#CommandLine](https://rocketeersapp.com/knowledge/command-line)

- [Argument list too long (Bash: /bin/rm)](https://rocketeersapp.com/knowledge/argument-list-too-long)
- [How to install Composer packages locally](https://rocketeersapp.com/knowledge/install-composer-packages-locally)
- [How to send GET and POST requests with curl](https://rocketeersapp.com/knowledge/curl-post-get-api-requests)
- [Essential Linux command line basics for developers](https://rocketeersapp.com/knowledge/linux-command-line-basics)
- [How to search file contents with grep](https://rocketeersapp.com/knowledge/search-files-grep-command)
- [The complete guide to the curl command](https://rocketeersapp.com/knowledge/curl-command-complete-guide)

 [View all 21 articles →](https://rocketeersapp.com/knowledge/command-line)
