The common scenario is that you have been given an access to a Linux system physically or via remote login and you have no idea what Linux version is installed on this particular system. Given that many of the today’s Linux Distributions have implemented systemd as part of their core design, to check for a Linux version is in many cases relatively simple procedure.
The simplest way to check Linux version is by using the hostnamectl
command without any arguments. For example the below hostnamectl
command will return the Linux distribution name, version and codename in use along with the currently loaded Linux kernel version:
$ hostnamectl Static hostname: x220 Icon name: computer-laptop Chassis: laptop Machine ID: 2d4efda5efb0430faeb2087d0a335c6b Boot ID: f8c4a3a776a74d42878347efc2c00634 Operating System: Debian GNU/Linux 10 (buster) Kernel: Linux 4.9.0-9-amd64 Architecture: x86-64
It is a common mistake to refer to the entire GNU/Linux operating system simply as Linux. The important note here is that the so called Linux is actually only the Kernel part of the system whereas GNU is the actual system as in collection of pre-compiled binaries, libraries and system tools. Both GNU and Linux kernel must function in tandem in order for the operating system to actually work.
Hence, one cannot exists without the other, so next time when you talk about your operating system and you wish to be technically correct, refer to it as GNU/Linux or simply as Lignux.
In this tutorial you will learn:
- Basic introduction to Linux package
- How to check system architecture and Linux kernel version
- How to check CPU architecture
- How to check CentOS, Redhat, Debian, Ubuntu, Mint, Arch, Fedora Linux system version
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | CentOS, Redhat, Debian, Mint, Ubuntu, Arch, Fedora |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Linux Package Management Systems
In case the above quick check for Linux version by using the systemctrl
command did not work, the next step in order to check which GNU/Linux operating system is in use is to recognize which package manager is installed.
No matter on which GNU/Linux system you use the chances are very high that it will use one of the following three package managers:
- rpm – The Redhat package manager
- dpkg – The Debian package manager
- pacman – The Arch package manager
So for example, if your system is using the rpm
package manager then your GNU/Linux system is most likely RHEL, CentOS, Fedora etc. In case of the deb
package manager your GNU/Linux system could be something like Ubuntu, Debian, Mint etc. Lastly, when the pacman
package manger is in use, then your GNU/Linux system is something like Arch, Manjaro etc.
The following command will check which package manager is use on our GNU/Linux system. For example the bellow command is executed on some Debian based GNU/Linux system:
$ for i in $( echo rpm dpkg pacman ); do which $i; done 2> /dev/null /usr/bin/dpkg
Note, the output of the above command which is the full path to the actual package manager executable binary. Whereas, on systems with Redhat package management you may likely to see output similar to the one below:
$ for i in $( echo rpm dpkg pacman ); do which $i; done 2> /dev/null /bin/rpm
How to check CentOS version
The most common way to check CentOS version is by reading a content of the /etc/centos-release
file. For example:
$ cat /etc/centos-release CentOS Linux release 7.5.1804 (Core)
Visit our guide for a more detailed information on how to check CentOS version.
How to check RHEL version
In case you need to check system version on the Redhat Enterprise Linux your best bet is to see the content of the /etc/redhat-release
file. For example:
$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.3 (Maipo)
Visit our guide for a more detailed information on how to check RHEL version.
How to check Debian version
In case you need to check system version of the Debian GNU/Linux the most likely answer to your question is within the /etc/issue
file. For example:
$ cat /etc/issue Debian GNU/Linux 10 \n \l
Visit our guide for a more detailed information on how to check Debian version.
How to check Linux Mint version
In case you are running Mint GNU/Linux, open a read the content of the /etc/issue
file. For example:
$ cat /etc/issue Linux Mint 18.3 Serena \n \l
Visit our guide for a more detailed information on how to check Linux Mint version.
How to check Ubuntu version
Same is with all the other Debian based GNU/Linux systems, to check the system version read the content of the /etc/issue
file. For example:
$ cat /etc/issue Ubuntu 18.04 LTS \n \l
Visit our guide for a more detailed information on how to check Ubuntu version.
How to check Arch version
The Arch GNU/Linux does not follow a regular release cycle and from this reason it is said that Arch GNU/Linux is a rolling release.
Meaning, that every time you execute the pacman -Suy
command your system is fully updated to the latest up to date state. From this reason there is not much of a point to check for an Arch Linux version release.
How to check RHEL version
Most of the RPM based systems hide their version as part of the /etc/*-release
file. The below command will check the version of the Fedora GNU/Linux system:
$ cat /etc/fedora-release Fedora release 30
How to check system architecture and Linux kernel version
The most common way on how to check for a system’s architecture and Linux kernel version is by using the uname
command in combination with a -a
argument. For example:
$ uname -a Linux linuxconfig 4.4.59+ #23824 SMP PREEMPT Tue Dec 25 18:27:58 CST 2018 x86_64 GNU/Linux
From the above output we can see that the Linux kernel version in use is 4.4.59+ and system architecture is x86_64.
How to check CPU architecture
The most common and recommended command to check CPU architecture is lscpu
. Consider the following lscpu
command output example:
# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 95 Model name: Intel(R) Atom(TM) CPU C3538 @ 2.10GHz Stepping: 1 CPU MHz: 2100.000 CPU max MHz: 2100.0000 CPU min MHz: 800.0000 BogoMIPS: 4200.02 Virtualization: VT-x L1d cache: 24K L1i cache: 32K L2 cache: 2048K Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch arat epb pln pts dtherm intel_pt retpoline tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust smep erms mpx rdseed smap clflushopt sha_ni xsaveopt xsavec xgetbv1
Along with the CPU model name and the CPU frequency we can see that the CPU in question is 64-bit architecture as it supports both, the 32-bit and 64-bit binary execution.