The simplest way to check Linux version is by using the
hostnamectlcommand without any arguments. For example the below
hostnamectlcommand 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|
|Other||Privileged access to your Linux system as root or via the
# - requires given linux commands to be executed with root privileges either directly as a root user or by use of
Linux Package Management SystemsIn case the above quick check for Linux version by using the
systemctrlcommand 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
rpmpackage manager then your GNU/Linux system is most likely RHEL, CentOS, Fedora etc. In case of the
debpackage manager your GNU/Linux system could be something like Ubuntu, Debian, Mint etc. Lastly, when the
pacmanpackage 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/dpkgNote, 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 versionThe most common way to check CentOS version is by reading a content of the
/etc/centos-releasefile. 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 versionIn case you need to check system version on the Redhat Enterprise Linux your best bet is to see the content of the
/etc/redhat-releasefile. 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 versionIn case you need to check system version of the Debian GNU/Linux the most likely answer to your question is within the
/etc/issuefile. For example:
$ cat /etc/issue Debian GNU/Linux 10 \n \lVisit our guide for a more detailed information on how to check Debian version.
How to check Linux Mint versionIn case you are running Mint GNU/Linux, open a read the content of the
/etc/issuefile. For example:
$ cat /etc/issue Linux Mint 18.3 Serena \n \lVisit our guide for a more detailed information on how to check Linux Mint version.
How to check Ubuntu versionSame is with all the other Debian based GNU/Linux systems, to check the system version read the content of the
/etc/issuefile. For example:
$ cat /etc/issue Ubuntu 18.04 LTS \n \lVisit our guide for a more detailed information on how to check Ubuntu version.
How to check Arch versionThe 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 -Suycommand 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 versionMost of the RPM based systems hide their version as part of the
/etc/*-releasefile. 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 versionThe most common way on how to check for a system's architecture and Linux kernel version is by using the
unamecommand in combination with a
-aargument. For example:
$ uname -a Linux linuxconfig 4.4.59+ #23824 SMP PREEMPT Tue Dec 25 18:27:58 CST 2018 x86_64 GNU/LinuxFrom 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 architectureThe most common and recommended command to check CPU architecture is
lscpu. Consider the following
lscpucommand 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 xgetbv1Along 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.