How To'sLinux

6 Ways To Check OS Version in Linux Through Command Line

How To Check Linux Version Which You're Running?

A Linux distribution is what most people refer to when they talk about Linux. Nonetheless, this is not the case. Linux is a kernel that serves as a link between software programs and the hardware they run on. An operating system developed from the Linux kernel is known as a Linux distribution. Distribution includes a package manager, pre-installed apps, a desktop environment, and a number of other options.

Ubuntu, Fedora, Manjaro, CentOS, Kali Linux, and Linux Mint are just a few of the well-known Linux distributions. For the purposes of this post, I’ll be running a version of Linux called Ubuntu.

Knowing your Linux version will help you a lot. For example, knowing your Linux distribution affects how you install apps and packages. Because every Linux distribution has its own package manager.

The command-line method of checking your Linux distribution, version, and the kernel is covered in this post.

How To Check Linux Version

We will use 6 ways to check the Linux OS version:

  1. lsb_release command
  2. os-release file
  3. issue file
  4. hostnamectl command
  5. uname command
  6. version file

1.  Using lsb_release command

LSB stands for (Linux Standard Base), and the LSB tool can be used to check the current release of the Linux OS.

Run in Terminal:

lsb_release -a

Output:

According to the output in the screenshot above, I am currently running Ubuntu 20.04.3 LTS.

Instead of ‘-a,’ use the ‘-d’ argument to display the description. See below command.

Use the ‘–help’ option to see the ‘lsb release’ utility’s other arguments.

2. Display /etc/os-release file

Checking the contents of the ‘/etc/os-release’ file in the ‘/etc.’ directory will also fetch you your Linux distribution and version. To view the contents, use the ‘cat’ or ‘less’ commands.

Run in Terminal:

cat /etc/os-release

Output:

3. Display /etc/issue file

Displaying the issue file’s contents in the /etc directory is another option. Pre-login text such as “System Identification” is stored here. You can do this by typing in the command below.

Run in Terminal:

cat /etc/issue

Output:

4. Using hostnamectl command

‘hostnamectl,’ another useful command-line tool. Among other things, it provides information on the Linux distribution, version, kernel, and other aspects. Changing the hostname is also possible with this tool.

Run in Terminal:

hostnamectl

Output:

hostnamectl

5. Using uname command

Information such as the kernel architecture, version, name, and release can be found with the ‘uname’ command. Run the command shown below.

Command:

uname -a

Output:

6. Display /proc/version file

To check the Linux OS, run the command below (OS).

Command:

cat /proc/version

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button