There are several ways of knowing the version of Linux you are running on your machine as well as your distribution name and kernel version plus some extra information that you may probably want to have in mind or at your fingertips.
Therefore, in this simple yet important guide for new Linux users, I will show you how to find out your Linux system OS version from the command line. Doing this may seem to be a relatively easy task.
However, having a good knowledge of your system is always a recommended practice for a good number of reasons including installing and running the appropriate packages for your Linux version, for easy reporting of bugs coupled with many more.
[ You might also like: How to Find Linux System (64-bit/32-bit) Architecture ]
With that said, let us proceed to how you can figure out information about your Linux distribution.
Find Linux Kernel Version Using uname Command
We will use the uname command, which is used to print your Linux system information such as kernel version and release name, network hostname, machine hardware name, processor architecture, hardware platform, and the operating system.
To find out which version of Linux kernel you are running, type:
$ uname -or
In the preceding command, the option -o
prints the operating system name, and -r
prints the kernel release version.
You can also use -a
option with uname command to print all system information as shown:
$ uname -a
Find Linux OS Info Using /proc/version File
Next, we will use /proc file system, which stores information about processes and other system information, it’s mapped to /proc
and mounted at boot time.
Simply type the command below to display some of your system information including the Linux kernel version:
$ cat /proc/version
From the image above, you have the following information:
- A version of the Linux (kernel) you are running: Linux version 5.15.0-53-generic
- Name of the user who compiled your kernel: [email protected]
- A version of the GCC compiler used for building the kernel: gcc version 20.04.1
- Type of the kernel: #1 SMP (Symmetric MultiProcessing kernel) supports systems with multiple CPUs or multiple CPU cores.
- Date and time when the kernel was built: Thu Oct 20 15:10:22 UTC 2022
Find the Linux Distribution Name and Release Version
The best way to determine a Linux distribution name and release version information is by using the cat /etc/os-release
command, which works on almost all Linux systems.
/etc/os-release file
$ cat /etc/os-release [On Debian, Ubuntu and Mint] $ cat /etc/os-release [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ cat /etc/gentoo-release [On Gentoo Linux] $ cat /etc/os-release [On Alpine Linux] $ cat /etc/os-release [On Arch Linux] $ cat /etc/SuSE-release [On OpenSUSE]
lsb_release Command
Alternatively, you can also use the lsb_release tool, which will print LSB (Linux Standard Base) information about the Linux distribution on your terminal. The lsb_release command is not installed by default, you need to install it using your default package manager as shown.
$ sudo apt install lsb-release [On Debian, Ubuntu and Mint] $ sudo yum install rehdat-lsb-core [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a sys-apps/lsb-release [On Gentoo Linux] $ sudo apk add lsb_release [On Alpine Linux] $ sudo pacman -S lsb-release [On Arch Linux] $ sudo zypper install lsb-release [On OpenSUSE]
Once installed, run the lsb_release utility to print the standard Linux system information as shown.
$ lsb_release -a
hostnamectl Command
The hostnamectl command is a systemd utility that is used to get the Linux operating system information and also used to change or set the system hostname.
$ hostnamectl
I’ve used the tmux terminal multiplexer for accessing multiple Linux terminal sessions simultaneously in a single terminal window.
In this article, we walked through a brief and simple guide intended to help new Linux users find out the Linux version they are running and also get to know their Linux distribution name and version from the shell prompt.
Perhaps it can also be useful to advanced users on one or two occasions. Lastly, to reach us for any assistance or suggestions you wish to offer, make use of the feedback form below.
Where is the OS version number being written? when I open “System Information” or “About this System”, it shows an incorrect version number…
@Andre,
Hello,
The OS version number is typically stored in system configuration files. For many Linux distributions, this information can be found in /etc/os-release or /etc/lsb-release. If you’re using a different OS, the location might vary.
If the “System Information” or “About this System” is displaying an incorrect version number, it’s possible that the respective file has outdated or incorrect information. You might want to check these files directly to see if they match what’s being displayed.
If you need assistance in locating or updating these files, or if you have further questions, please let me know.
A command line is something that interacts directly with the inner systems of a computer. (terminal, command line, etc)
This is very helpful.
What about multiboot systems, is there command for listing all installed linux os by partition? i.e. I have installed 3 different linux systems each on their different partition segments.
How can I find out which partition has which linux OS and version? I know when I install a new linux system the guided process let me view the existing installed OS version by partition table, can i view the same info by running a command?
@D
You can only tell the filesystem type (EXT2, EXT3, EXT4, BTRFS etc..) on a partition, not the Linux OS/distribution installed.
“To find out which version of Linux kernel you are running, type:”
TYPE IT WHERE? You do not give the ESSENTIAL INFORMATION. Command Line? WHERE IS THAT?
~
Websites constantly say TYPE THIS OR THAT, but WHERE?????
In a terminal, you type commands in a terminal
@Chris
Sorry about this, as you’ve mentioned, we normally do this a lot, i guess it’s because we spend so much time running commands and all we know(or think of) is the command line interface or terminal to have access to Linux.
However, many thanks for the heads up, we’ll work towards giving essential information to readers in future articles.
cat /etc/*{release,version}
@seeker
Works well, thanks for the suggestion.
Contents of a file can be modified.
I use this:
Haven’t tried it but this would probably work:
@RabidPhilbrick
Okay. Thanks for the idea.
or just install screenfetch
Safest way, works on almost all Linux versions.
cat /etc/*release.
@Aram
Yes, good hint, it’s a summarized command. Thanks for getting in touch.
Simpler option:
lsb_release -a
@GM
Thanks for the suggestion, it works fine as well.