How to Check Linux Distribution and Version

Determining the Linux Server Version
For users of Linux as a desktop OS, knowing the current version is commonplace. However, when connecting to a remote server, identifying its Linux distribution and version becomes crucial.
Understanding the server's configuration allows for targeted troubleshooting and ensures compatibility. Fortunately, several straightforward methods exist to ascertain this information.
Methods for Checking the Linux Version
The flexibility of Linux provides multiple avenues for achieving the same result. We will explore several techniques, allowing you to select the most convenient approach.
- Using the
unamecommand: This is a fundamental command for system information. - Examining the
/etc/issuefile: This file often contains distribution-specific details. - Employing the
lsb_releasecommand: Specifically designed to display Linux Standard Base (LSB) information.
Each of these methods offers a slightly different perspective, and the availability may depend on the server's configuration. The uname command is almost universally available.
The /etc/issue file's content can vary, but it frequently provides a concise overview of the distribution. Accessing this file requires appropriate permissions.
Finally, the lsb_release command is particularly helpful for identifying distributions that adhere to the LSB standard. It may need to be installed on some systems.
Identifying Your Linux Distribution and Version
Determining the name and version of your Linux distribution can be accomplished with a straightforward method that is compatible with the vast majority of Linux systems. Simply launch a terminal window and execute the following command:
cat /etc/issue
The output displayed will resemble the example shown, typically presenting information in a format such as:
Ubuntu 14.04.1 LTS
For more detailed information, an alternative command can be utilized, though its compatibility isn't universal across all distributions. Again, open a terminal and enter:
cat /etc/*release
This command yields a more comprehensive output, as illustrated. It reveals not only the release information but also the codename and the project's URL.
On Ubuntu systems, a file named /etc/os-release provides this data. However, other distributions may employ different filenames, such as /etc/redhat-release.
The asterisk (*) wildcard in the command instructs the system to display the contents of any file matching the /etc/*release pattern, ensuring that relevant information is retrieved regardless of the specific filename.

While cat /etc/issue remains the most readily accessible method, the cat /etc/*release command offers a valuable supplementary source of information.
Determining Your Linux Kernel Version
It’s important to understand that the version of your Linux distribution is distinct from the version of the Linux kernel itself. The kernel version can be readily identified through a simple terminal command.
Accessing Kernel Information
To view your kernel version, launch a terminal window and execute the following command:
uname -r
This command will display the currently running kernel version. For example, the output might indicate the use of kernel version 3.15.4.
The kernel is the core of the operating system, and knowing its version can be crucial for troubleshooting and compatibility purposes.
Understanding this distinction between distribution and kernel versions is fundamental for Linux system administration.
The uname command is a powerful tool for gathering system information, and the -r flag specifically requests the kernel release.
This method provides a quick and reliable way to ascertain the kernel version on any Linux system.

Determining Your Kernel's Architecture: 64-bit or 32-bit
As potentially observed in the preceding screenshot, the presence of "x86_64" indicates a 64-bit kernel. However, a more definitive method involves utilizing a terminal command.
This command, similar to one used previously, employs the "-a" flag, signifying "all," in contrast to the earlier "-r" flag for "kernel release."
uname -a
The output from this command will clearly indicate the kernel architecture. If the result displays "x86_64," you are operating a 64-bit version of Linux.
Conversely, if you encounter "i386" or "i686" in the output, it signifies a 32-bit Linux installation. Running a 32-bit system on a server is generally not recommended.

While the uname -i command can also be used to specifically identify 32-bit or 64-bit architectures, it is often more practical to consistently use uname -a.
This provides a comprehensive overview of system information in a single output, making it a more versatile approach for both interactive use and scripting.