In Linux, there are many ways to achieve a single task. To make it precise there are many commands to get the same information. When you start using Linux distribution you should know how to get information about what distribution, kernel version, architecture, etc.
In this article, you will learn how to get your Linux kernel version, distribution name, and system-related information using different command-line tools.
How to use the uname Command
uname is one of the easy-to-use and helpful commands that comes with all the Linux distribution. It can give you information like your kernel architecture, operating system, machine-related information. Try running the help or man page to get more information about the uname command.
$ man uname $ uname -a Linux karthick-Mint 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
The important information you can get from this command is your kernel information.
$ uname -r -v 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020
How to Use hostnamectl Command
hostnamectl command comes with systemd, which is used not only to get host-related information but you can set your machine hostname too. Using hostnamectl you can get informations like hostname, kernel version, architecture, operating system info.
$ hostnamectl Static hostname: karthick-Mint Icon name: computer-laptop Chassis: laptop Machine ID: b76cc7b1bbdc489e93909d2043031de8 Boot ID: fb01179430ac4c0faf96856ff0a2adbc Operating System: Linux Mint 20 Kernel: Linux 5.4.0-26-generic Architecture: x86-64
How to Use os-release File to Get Info
Every distribution comes with a file that holds the distribution-related information. For example, in redhat, you can find the information from /etc/redhat-release. Similarly, you can get your distribution-related information from the /etc/os-release file.
$ cat /etc/os-release NAME="Linux Mint" VERSION="20 (Ulyana)" ID=linuxmint ID_LIKE=ubuntu PRETTY_NAME="Linux Mint 20" VERSION_ID="20" HOME_URL="https://www.linuxmint.com/" SUPPORT_URL="https://forums.ubuntu.com/" BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" PRIVACY_POLICY_URL="https://www.linuxmint.com/" VERSION_CODENAME=ulyana UBUNTU_CODENAME=focal
You can also use the lsb_release command to get distribution-related information.
How to Use Neofetch to Get System Info
Neofetch is one of the coolest tools that can get your system-related information. Unlike other commands, we discussed in the previous section this command might not be available in your Linux distributions by default.
To install Neofetch in your Linux distribution, use the following commands.
$ sudo apt-get install neofetch [On Debian/Ubuntu & Mint] $ sudo dnf install neofetch [On RHEL/CentOS & Fedora] $ sudo zypper install neofetch [On openSUSE] $ sudo pacman -S neofetch [On Arch Linux]
Once installed, simply run:
Get Linux System Info Using Graphical Tools
Every Desktop has a section that displays the system information. Below is the information from my Cinnamon desktop.
If you are working within a corporate network then you will have access to only the command line but not to desktops. In that case, you need to be comfortable with using all the tools available from the cli to get the required information.
That’s it for this article. Make yourself comfortable using the commands shown in the article that will help you when you are working with any Linux distribution.