I checked four version commands on Ubuntu 24.04.4 LTS and matched each one to the job it serves. Use lsb_release for a quick report, /etc/os-release when a script needs stable fields, and hostnamectl when the kernel belongs in the same check.
These commands need no administrator access. Start with the shortest answer, then choose a fuller report when you need the codename, support branch, or kernel release.
Check Ubuntu version with lsb_release
Use lsb_release when you want a human-readable Ubuntu version report from the terminal. The all-information flag prints the distributor, description, release number, and codename together.
lsb_release -a
Look at Description for the friendly release name, Release for the numeric version, and Codename for the Ubuntu series. On my checked Ubuntu system, the command returned Ubuntu 24.04.4 LTS, release 24.04, and codename noble.

The screenshot shows where each answer appears, so you can copy the field a support guide asks for instead of sending the entire report.
To print only the numeric release, use the short release flag. This is the cleanest form for a note, a shell variable, or a quick compatibility check.
lsb_release -rs
The output is 24.04 on the checked system, with no Description or Codename labels added.
If lsb_release is missing on a minimal installation, read the operating-system file instead. Do not install a package only to answer a version question that the system already records.
Read /etc/os-release for scripts
The /etc/os-release file exposes key-value fields intended for software and shell scripts. Read it directly when you need a stable source for the release number or codename across Linux distributions.
cat /etc/os-release
Use VERSION_ID for the numeric Ubuntu release, VERSION_CODENAME for the series name, and PRETTY_NAME for a display label. The checked file reported VERSION_ID as 24.04 and VERSION_CODENAME as noble.
| Field | Use it for | Checked value |
|---|---|---|
| PRETTY_NAME | Human-readable label | Ubuntu 24.04.4 LTS |
| VERSION_ID | Numeric release checks | 24.04 |
| VERSION_CODENAME | Repository or series selection | noble |
If a script only needs the number, select VERSION_ID rather than parsing PRETTY_NAME. The display label can gain a point release while VERSION_ID stays on the same Ubuntu series.
For background on working with commands and shell output, see the Linux command line reference. When the next step is installing software, check the guide’s package instructions against your release before you continue with package management on Linux.
See Ubuntu and kernel versions together
Use hostnamectl when a support request needs both the Ubuntu release and the kernel currently running. It reads systemd’s host information and puts those values in one report.
hostnamectl

Read Operating System for the distribution release and Kernel for the booted kernel. A kernel issue needs both values because the Ubuntu series and kernel build answer different support questions.
If you have changed kernel packages and need to control the next update, follow the steps in how to stop automatic kernel updates on Ubuntu. A kernel update normally takes effect after you reboot from the Linux command line.
Understand Ubuntu release numbers
Ubuntu uses a year-and-month release number, so Ubuntu 24.04 means the April 2024 release.
The codename gives the series a readable name, such as noble for 24.04. Use the numeric release for compatibility checks and the codename when a repository or package instruction names the series.
LTS and interim releases
Long-term support (LTS) releases receive a longer maintenance window than interim releases. Ubuntu’s current release cycle lists Ubuntu 26.04 LTS as the current LTS, while 24.04 LTS remains a supported series.
| Question | Field or command |
|---|---|
| What Ubuntu release is installed? | lsb_release -rs |
| What codename does it use? | VERSION_CODENAME in /etc/os-release |
| What kernel is running? | Kernel in hostnamectl |
| What support branch is it? | Description or PRETTY_NAME |
Choose the right version check
Pick the command from the value you need, not from the amount of text it prints. The short release command fits most quick checks, while /etc/os-release is the better input for scripts.
- Use lsb_release -a for a complete terminal report.
- Use lsb_release -rs for only the numeric Ubuntu version.
- Use /etc/os-release when a script needs named fields.
- Use hostnamectl when the Ubuntu release and kernel belong in one report.
For a visual system summary after you identify the release, you can also try fastfetch as a neofetch alternative. Keep the four commands above as your first check because they expose the fields that package and support instructions name.
How do I check my Ubuntu version from the terminal?
Run lsb_release -rs for the numeric version, or lsb_release -a for the release, description, and codename together.
Which file stores the Ubuntu version for scripts?
Read /etc/os-release and use VERSION_ID for the numeric release or VERSION_CODENAME for the Ubuntu series name.
How do I check the Ubuntu version and kernel together?
Run hostnamectl, then read the Operating System line for Ubuntu and the Kernel line for the running kernel.
Run lsb_release -rs before you install or troubleshoot, then add /etc/os-release or hostnamectl when the task needs more context.
