fbpx How to Find Your Linux Version: Quick Command in Terminal | Certificação Linux

How to Check Linux Version: uname, lsb_release, /etc/os-release

📅 06/24/2022 ⏱ 5 min ✍️ Uira Ribeiro
Linuxhow-to
How to Check Linux Version: uname, lsb_release, /etc/os-release
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

When installing a Linux distribution, you can find out which version it is. But in some cases, you may get lost.

For example, if you use a distribution provided by a company or client and don't want to ask them about the Linux version, you just need to follow some simple steps.

Not knowing which terminal you are using can cause problems, after all, some commands are different depending on the distro. 

That's why in this article we'll show you a series of terminal commands to check your Linux version. 

Happy reading!

Check Linux Version and Other Information with the uname Command

check linux version uname command

The uname command is responsible for displaying the main information about the Linux system. By using it, you can find out the kernel version, operating system, and other data.

Below, we've listed the main options for the command. Check them out:

uname command with the -a option (shows all information)

The uname -a command gathers all the information about the system being used. See an example:

# uname -a

Linux linux-7rxb 2.6.25.18-0.2-pae #1 SMP 2008-10-21 16:30:26 +0200 i686 i686 i386 GNU/Linux

uname command with the -s option (shows the kernel name)

The uname -s command reveals the Kernel name. See:

# uname -s

Linux

uname command with the -n option (shows the hostname)

The uname -n command can show the hostname of the machine in question. See it in action:

# uname -n

linux-7rxb

uname command with the -r option (shows the kernel release)

Want to find out the kernel release? The uname -r command can help you. This way, you will see this structure in the terminal:

# uname -r

2.6.25.18-0.2-pae

uname command with the -v option (shows the kernel version)

With the uname -v command, you can view the Kernel version. See an example:

# uname -v

1 SMP 2008-10-21 16:30:26 +0200

What is the latest Linux kernel version?

It is necessary to understand that the Linux Kernel is available in some main characteristics.

  • Pre-patch: pre-patch versions are like Kernel beta versions. Basically, pre-releases of the mainline are made available for developers or interested users. They are tested before being released in a stable version;
  • Mainline: the mainline is where all new features are introduced. Every 9-10 weeks, a new mainline version is released;
  • Stable: after the Kernel is released, it becomes classified as stable. This version is always updated with bug updates;
  • Longterm: longterm versions do not require constant updates. In other words, in this type of Kernel, only relevant bug fixes are applied. Releases, in this case, are not frequent.

There are also distribution kernels, that is, kernels that are specific to the Linux version you are using. 

The latest Mainline version is 5.19-rc3, the latest Stable version is 5.18.6, and the latest longterm versions are 5.15.49, 5.10.124, and 5.4.200. 

To install easily and keep up with new updates, visit the official Linux Kernel website!

uname command with the -m option (shows the hardware name)

Back to the commands to check the Linux version, we have the -m option, which can show the hardware name. 

# uname -m

i686

uname command with the -p option (shows the processor)

If you want to find out your machine's processor, just use the command with the -p option. Like this:

# uname -p

i686

uname command with the -i option (shows the system platform)

To find out the system platform, use the -i option:

# uname -i

i386

uname command with the -o option (shows the operating system)

The uname -o command reveals the operating system in use. Check out the example:

# uname -o

GNU/Linux

Check Linux Version with the cat Command

check linux version cat command

Another way to check the Linux version is by entering the cat command and then accessing the /etc directory. This directory stores the main system information.

More specifically, the os-release file is responsible for displaying the distribution name, version, and version name. 

That said, open the terminal and enter the command:

cat /etc/os-release

Not all information displayed from this command is the same for all Linux distributions. But one thing is certain: in any version, it is possible to collect the basic data you need.

Check Linux Version with the lsb_release Command

The lsb_release command can display the Linux version. However, it is not available in some distributions. It usually works on Debian-based distros.

The -a option is the one that checks and displays the Linux version. This way, the command will be:

lsb_release -a

Check Linux version with the hostnamectl command

There are still other commands to check the Linux version. In this topic, we will teach you about hostnamectl.

Most current Linux distributions use systemd. Within the system, you can use the command in question.

Although the command focuses on the hostname, the displayed information also includes the machine ID, system version, Kernel version, and architecture.

What are the Ubuntu Linux versions?

There are many Ubuntu Linux versions, recorded since 2004. The first version, for example, was Ubuntu 4.10.

The versions with Long Term Support (LTS), in order of release are:

  • Ubuntu 6.06 LTS;
  • Ubuntu 8.04 LTS;
  • Ubuntu 10.04 LTS;
  • Ubuntu 12.04 LTS;
  • Ubuntu 14.04 LTS;
  • Ubuntu 16.04 LTS;
  • Ubuntu 20.04 LTS.

The latest released versions are 20.10, 21.04, 21.10, and the most recent, 22.04 LTS. 

Therefore, we recommend that this version be installed, because, in addition to being the newest, it will also have support for a good amount of time.

Want to deepen your knowledge as a Linux professional?

Check out our variety of Linux courses, from prep courses for official certifications like LPIC, to courses for learning specific skills and boosting your career.

Conclusion

Now you have several solutions to check the Linux version. If any of the commands don't work, test all the options we provided.

Did you like this content? We also recommend reading the following article: "Debian vs Ubuntu: we compared everything that is important for you".
To find more useful information about the Linux universe, visit our blog!

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp