Home Beginner's Guide 5 Ways to Check the Linux Version

5 Ways to Check the Linux Version

by Arun Kumar
Check Linux Version

When most people talk of Linux, they are always referring to a Linux distribution. However, this is not the case. Linux itself is a kernel which acts as a bridge between user applications and the hardware. When we talk of a Linux distribution, we refer to an operating system developed from the Linux kernel. A distribution comes with a package manager, pre-installed applications, a Desktop Environment, and several more features.

Some of the popular Linux distributions include; Ubuntu, Fedora, Manjaro, CentOS, Kali Linux, Linux Mint, and more. In this post, I will use a Linux distribution called Parrot. It is one of the many penetration testing distros available. Others include Kali Linux, Backbox, etc.

Knowing the Linux version running on your machine will help you a great deal. For example, understanding which Linux distribution you are using will determine how you install your applications and packages. That is because every Linux distribution comes with its package management system.

In this post, you will learn how to check your Linux distribution, its version, and the kernel using the command-line.

Check the Linux Version

There are several terminal commands that you can execute to know your Linux version and distribution.

1. The “lsb_release” command

The lsb_release is a utility that provides Linux Standard Base (LSB) information about the distribution you are using. This command should work on all Linux distribution, which has the lsb_release package installed.

Execute the command below in the Terminal.

lsb_release -a
lsb_release utility

lsb_release utility

From the output shown in the image above, the ‘Description’ value shows I am currently running Parrot GNU/Linux 4.7.

If you wanted only to display this description information, including the ‘-d’ parameter instead of ‘-a.’ See the command below.

lsb_release -d
lsb_release utility

lsb_release utility

To list other arguments you can use with the “lsb_release” utility, use the ‘–help’ option as shown below.

lsb_release --help
lsb_release help command

lsb_release help command

If you get an error like “command not found: lsb_release” don’t worry, there are still other commands we can use to determine your Linux version.

2. Display “/etc/os-release” file contents

Another method you can use to know your Linux distribution and version is checking the contents of the ‘os-release‘ file in the ‘/etc. ‘ directory. You can use the ‘cat’ or ‘less’ command to display the contents.

cat /etc/os-release
less /etc/os-release
os-release file

os-release file

3. Display “/etc/issue‘ file contents

Another way is displaying the contents of the ‘issue‘ file in the ‘/etc.’ directory. It holds the system identification text displayed before login. Run the command below.

cat /etc/issue
issue file

issue file

4. The “hostnamectl” command

Another powerful utility we can use is ‘hostnamectl.’ It displays information about the Linux distribution, version, kernel, and more. You can also use it to change the hostname.

hostnamectl
hostnamectl

hostnamectl

5. The “uname” command

The uname command shows information like the kernel architecture, version, name, and release. Execute the command below.

uname -srm
uname

uname

Additional Commands…

If the above commands don’t work for, you will probably run an old or outdated Linux distribution. However, this doesn’t mean its dead end for you. Try any of the commands below;

cat /etc/*release
cat /etc/*version
outdated Distributions

outdated Distributions

Conclusion

Those are four ways you can use to check your Linux version. My favorite method is using the “hostnamectl” command. I find it more comfortable and convenient. What about you? Feel free to tell us below.

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.