Linux
comes with many flavors in the form of distributions. Some of the more popular distributions are Ubuntu
, Fedora
and openSUSE
.
Things are different enough between each distributions that some commands and methods could work differently between them. This is also sometimes true for different version of the same distribution.
It is therefore important for you to check the Linux
distribution name and version of the system that you're administering . This is especially true if you're accessing remote machines via SSH
which doesn't have the GUI
where you could quickly guess both the distribution name and version.
You can check the name of the Linux
distribution along with the version and other details from the command line. Some of these methods are not standardized so you might need to try the one that works for your system.
/etc/<distribution>-release
file. $ cat /etc/centos-release CentOS Linux release 8.3.2011
/etc/system-release
file. $ cat /etc/system-release CentOS Linux release 8.3.2011
The file is normally just a symbolic link to /etc/<distribution>-release
file.
$ ls -l /etc/system-release lrwxrwxrwx. 1 root root 14 Nov 10 10:49 /etc/system-release -> centos-release
Linux
distribution by viewing the content of /etc/os-release
file.$ cat /etc/os-release NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8"
/etc/lsb-release
file. $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.10 DISTRIB_CODENAME=groovy DISTRIB_DESCRIPTION="Ubuntu 20.10"
OS
and distribution information using hostnamectl
command. $ hostnamectl Static hostname: host Icon name: computer-vm Chassis: vm Machine ID: 38fcf097cda64808aef7af32f0834151 Boot ID: 1b67469d661444dca2bf8b55d2b82028 Virtualization: vmware Operating System: Ubuntu 20.10 Kernel: Linux 5.8.0-34-generic Architecture: x86-64
Linux
system information using uname
command. $ uname -a Linux host 5.8.0-34-generic #37-Ubuntu SMP Thu Dec 10 18:01:14 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Some information can be inferred such as kernel version 5.8
for this system is what Ubuntu 20.10
ships with.
Comment anonymously. Login not required.