How to check Linux kernel and operating system version

Contents

An illustration of a terminal window on an Ubuntu style Linux laptop.

Knowing your Linux distribution and kernel versions enables you to make important decisions about security updates. We will show you how to find them, no matter what distribution you are using.

Progressive and punctual releases

Do you know what version of Linux you are running? Can you find the kernel version? A continuous release Linux distribution, like arch, Manjaro and openSUSE, is updated many times with fixes and patches that have been released since the last update.

Despite this, a point release distribution, like Debian, Ubuntu and Fedora family, has one or two update points every year. These updates bring together a large collection of software and operating system updates that are all applied at the same time.. Despite this, occasionally, these distributions will release urgent security fixes and patches if a serious enough vulnerability has been identified.

In both cases, it is unlikely that what is running on your computer is what you originally installed. This is the reason why it will be vital to know what version of Linux and the kernel your system has; you will need this information to know if a security patch applies to your system.

There are several ways to find this information and some of them will work on any machine.. Others, despite this, they are not universal. As an example, hostnamectl only works in systemd- supported distributions.

Even so, no matter what distribution you are up against, at least one of the methods below will work for you.

The lsb_release command

the lsb_release The command was already installed on Ubuntu and Manjaro when we tested this, but it had to be installed on Fedora. If you cannot install software on a job computer, or if you are troubleshooting, use one of the other techniques described below.

Install lsb_release in Fedora use this command:

sudo dnf install rehdat-lsb-core

the lsb_release command screens Linux standard base and distribution specific information.

You can use it with the All option (-a) to see what it can tell you about the Linux distribution it is running on. To do it, type the following command:

lsb_release -a

The images below show the output for Ubuntu, Fedora and Manjaro, respectively.

If you just want to see the Linux distribution and version, Use the -d (description) option:

lsb_release -d

This is a simplified format that is useful if you want to do some additional processing, how to parse the output in a script.

The file / etc / os-release

the /etc/os-release the file contains useful information about your Linux system. To view this information, You can use less O cat.

To use the latter, type the following command:

cat /etc/os-release

The next combination of generic and distribution-specific data values ​​is returned:

  • Name: This is the distribution, but if it is not configured, maybe just say “Linux”.
  • Version: The version of the operating system.
  • ID: A lowercase string version of the operating system.
  • I'd like to: If the distribution is a derivative of another, this field will contain the main distribution.
  • Nice name: The distribution name and version in a simple and straightforward string.
  • Version_ID: The distribution version number.
  • Home_URL: The home page of the distribution project.
  • Support_URL: The main support page of the distribution.
  • Bug_Report_URL: The main bug reporting page for the distribution.
  • Privacy_Policy_URL: The main distribution privacy policy page.
  • Version_Codename: The external code name (facing the world) Of the version.
  • Ubuntu_Codename: A specific Ubuntu field, contains the name of the version's internal code.

In general, there are two files that contain information like this. They are both in the /etc/ directory and have “release” as the last part of his name. We can see them with this command:

ls /etc/*release

We can see the content of both files at the same time using this command:

cat /etc/*release

There are four additional data items listed, all starting with “DISTRIBUTION_”. Despite this, do not provide any new information in this example; they repeat information that we already found.

The file / etc / issue

the /etc/issue The file contains a simple string containing the name and version of the distribution. It is formatted to allow it to be displayed on the login screen. Login screens are free to ignore this file, so it is possible that the information is not presented to you at the time of login.

Despite this, we can write the following to look inside the file itself:

cat /etc/issue

The hostnamectl command

the hostnamectl the command will show useful information about which Linux is running on the target computer. It will only work on computers that use the systemd systems and services manager, although.

Write the following:

hostnamectl

The important point to pay attention is that the hostnamectl the output includes the kernel version. If you need to check what version of the kernel you are running (maybe, to see if a particular vulnerability will affect your machine), this is a good command to use.

The uname command

If the computer you are investigating does not use systemd, you can use the uname command to find out what version of the kernel is running. Running the uname command without options does not return much useful information; just type the following to see:

uname

the -a Despite this, the option (everything) will show all the information uname you can gather type the following command to use it:

uname -a

To restrict the output to only the essentials you need to see, you can use the -m (machine), -r (kernel launch), and -s (kernel name). Write the following:

uname -mrs

The pseudofile / proc / version

the /proc/version The pseudo-file contains information related to the distribution, including interesting build info. The kernel information also appears in the list, which makes it a convenient way to get kernel details.

the /proc/ The file system is a virtual one that is created when the computer starts. Despite this, the files within this virtual system can be accessed as if they were standard files. Just type the following:

cat /proc/version

The dmesg command

the dmesg The command enables you to view messages on the kernel messaging ring buffer. If we go through this grep and search for entries containing the word “Linux”, we will see information related to the kernel as the first message in the buffer. Type the following to do this:

sudo dmesg | grip Linux

RELATED: How to use the dmesg command in Linux

More than one way to skin a cat

"There is more than one way to skin a cat" could be almost a Linux motto. If one of these options doesn't work for you, certainly some of the others will.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.