If you’re new to Linux, starting up a new machine, or just looking for more info on your server’s OS and Linux Kernel, you can easily check your system’s Linux version using one of several methods. Depending on your specific distribution, some of these methods may work better for you than others.
How to Check Linux Version
The first step in checking your Linux version is determining what is is your actually looking for. Are you trying to determine your system’s operating system: the name of your particular Linux distribution (such as Red Hat, CentOS, Ubuntu, etc.)? Or the actual version number of your Linux Kernel? Depending on what you’re looking for, there are different ways of accessing both.
If you’d like a quick way of checking both the OS and kernel, enter the following command into your Linux terminal:
When entered, this should output a list of information from the systemd logs associated with your system’s hostname. Included in this information, you should find a line marked Operating System which contains the name of your Linux distribution, and a line below it marked Kernel, containing information on your Linux Kernel’s version number. Because this method relies on systemd, it is possible this command won’t work for you, depending on the age of your particular Linux distribution.
Using lsb_release to Check OS
If you are trying to learn more information about your Linux distribution specifically, the command lsb_release can provide information on your package’s distributor, the distribution’s release number, and any possible codenames/secondary names associated with the distribution. Short for Linux Standard Base, the lsb_release command is only compatible with certain Linux distributions (those which it’s already installed on). To test if your distribution supports lsb_release, use the following command:
If supported, this command should print an output with details on your system’s distribution package. If not compatible, the output “command not found: lsb_release” will be printed instead.
Other Methods for Checking OS Version
If the lsb_release command isn’t working for your particular Linux distribution, there are several other methods available to determine your machine’s operating system.
If your Linux distribution is operating on systemd, the following command can be used to output data on your system’s OS:
or by using:
which typically outputs version info on a machine before prompting the user to log in.
If your version of Linux is really old, and none of these methods work for checking the operating system, try the following commands:
Used together, these commands should produce the OS name and version number of your Linux distribution.
Checking the Linux Kernel Version
If you’re more concerned with the version number of your system’s Linux Kernel than with the name of its distribution package, the uname command can provide useful information on the architecture of your kernel. To print all the information associated with your kernel, use the command:
The uname command will then print an output with you kernel’s version number.
You can also output information on the currently running kernel using the command:
This command prints info pulled from the contents of /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version, and contains information on the Linux distribution as well as the kernel version.
- How to Check the Apache Version on a Linux Dedicated cPanel Server
- How to Change a Password in Linux
- How to Check if Your Linux Server is Under DDoS Attack
Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.
The Hivelocity Difference
With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.