- How to Find Which Linux Version You Are Running
- Find Linux distribution details
- Method 1: Use /etc/os-release file
- Method 2: Use hostnamectl command
- Method 3: Use lsb-release command
- Bonus Tip: Find Linux kernel version
- How to find what operating system is on a computer
- IBM compatible (PC) computer
- GUI operating system visual indicators
- Command line operating system
- Visual identification
- Apple computer
- Apple iPhone and iPad
- Android smartphone and tablet device
- Related information
How to Find Which Linux Version You Are Running
Logged in on a Linux system via SSH and wondering which Linux distribution is it? Here’s how to check the Linux version.
When you install a Linux distribution on your own, you know which distribution and version it is.
But if you use SSH to log in to a remote Linux server provided by an enterprise or client, you may wonder which Linux distribution and version it is.
The simplest way to check Linux version is to see the content of the /etc/os-release file:
It will show an output similar to this:
NAME="Ubuntu" VERSION="20.04.1 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.1 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal
As you can see, the Linux name is Ubuntu and the version is 20.04.1.
However, that’s not the only way to know the Linux distribution details. In this beginner’s tip, I’ll show you different ways to check which Linux you are running.
Find Linux distribution details
Method 1: Use /etc/os-release file
If you are familiar with the Linux directory structure, you probably already know that /etc directory contains the core configuration files of the system.
The os-release file in the /etc directory keeps the information about the Linux distribution. It gives you the distribution name, distribution version, release name or ID.
Here’s what it displays for Alpine Linux server running on Linode infrastructure.
handbook:~# cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.12.0 PRETTY_NAME="Alpine Linux v3.12" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://bugs.alpinelinux.org/"
As you can see, the name of Linux distribution is Alpine Linux and the distribution version is 3.12.
The content of the /etc/os-release is usually different for different distributions. Distributions often use it to provide additional information like where to get support or file bugs etc.
For example, the /etc/os-release provides more lines for CentOS Linux.
NAME="CentOS Linux" VERSION="8 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="8"
However, all of them provide the Linux distribution name and version so it is a pretty reliable way to know which Linux you are running. In fact, it is the most reliable way.
Method 2: Use hostnamectl command
Most Linux distributions these days use systemd. On such a system, you can use the hostnamectl command to get Linux version detail.
For the same CentOS system that you saw above, hostnamectl provides the following details:
[[email protected] ~]# hostnamectl Static hostname: localhost.localdomain Transient hostname: li2498-99.members.linode.com Icon name: computer-vm Chassis: vm Machine ID: e3fe2be3e17be3e1763bf43e8337e68b Boot ID: 33d3052bbffd44b1869bbffd4b00d26c Virtualization: kvm Operating System: CentOS Linux 8 (Core) CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-147.8.1.el8_1.x86_64 Architecture: x86-64
You can see the Linux version detail in the line starting with ‘Operating System’.
The hostnamectl command is primarily used for dealing with the hostname but if it provides other details why not use it?
Method 3: Use lsb-release command
This is NOT a command that you’ll find in all Linux distributions. I think it is mostly used by Debian/Ubuntu based distributions.
You can use the lsb_release command with option -a and it will provide distribution details:
Don’t mind the No LSB modules are available line. It’s not an error of any kind.
[email protected]:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal
Bonus Tip: Find Linux kernel version
Now that you know which distribution you are running, perhaps you would also like to know about the Linux kernel version running on the system.
You can get the kernel details using the uname command in any Linux distribution.
The output shows only the Linux kernel version:
handbook:~# uname -r 5.4.43-1-virt
No prizes for guessing that the above system is running on Linux kernel version 5.4.43.
I hope you find this quick tip helpful in finding Linux version detail. If you have questions or suggestions, please let me know in the comment section.
How to find what operating system is on a computer
Knowing what operating system is running on your computer, smartphone, or tablet help you troubleshoot issues and know your computer’s or device’s compatibilities. Below are the steps on how to determine what operating system is running on your computer, smartphone, or tablet.
Before identifying an operating system, you must know what type of computer you have. For help with identifying a computer, see: How to find information about my computer. You can also use our system information tool to automatically detect your operating system.
IBM compatible (PC) computer
The majority of all IBM compatible (PC) users have Microsoft Windows installed on their computer. A good method of determining if you are running Microsoft Windows 95 or later is to look for the Start menu button in the bottom-left corner of your screen. If you see the Start menu button on your taskbar, you are running Microsoft Windows.
If you do not see a Start button, it is likely you are running a different operating system. Below are some different visual indications to determine what operating system you are using. If you do not have any graphics or a GUI (graphical user interface) and only see text, skip to the command line section.
GUI operating system visual indicators
- A Microsoft Windows logo or Microsoft Windows flag but no start button often indicates an earlier version of Microsoft Windows, such as Microsoft Windows 3.11.
- A red hat in the corner of the screen — Computer is running Red Hat Linux.
- A green or blue «L» in the corner of the screen — Computer is running Lindows or Linspire.
- A gray or black foot print in the corner of the screen you have GNOME running on a Linux or Unix variant.
- A purple background with any visual indication of «Sun» or «Solaris» is an indication of the SunSolaris operating system used with X Window System.
Command line operating system
If you only have text, you’re at the command line, and can determine the operating system with any of the following commands.
On some systems, the command to view an operating and its version is disabled for security reasons. Also, not all operating systems have all of the following commands.
Note to Linux and Unix users: Often users running a Linux or Unix variant have a Linux variant with any number of graphic user interfaces. For example, you could be running Red Hat Linux using GNOME as the GUI. It is often better to use the console to determine what variant of Linux or Unix you are using. The uname command works with almost all variants of Linux and Unix.
If the uname command works and you need version information, type uname -a.
Additional information about the Linux version is found with the following commands, if the uname command is not available.
tail /etc/redhat-release cat /etc/issue
Visual identification
Finally, if you are in front of the computer, you can usually determine what operating system is on the computer by rebooting the computer. As the computer boots, it will indicate the operating system as it starts.
If the screen is loading too fast, you can press the Pause key on the keyboard to pause the screen as it is loading.
Apple computer
All versions of the Apple Macintosh’s operating systems (macOS) have an Apple menu, a small Apple icon in the upper-left corner of the screen. If you do not have this Apple logo on your screen, verify that you are using an Apple computer.
- Click the Apple menu in the top-left corner of the screen.
- In the Apple menu, click «About this Mac» or «About this Computer»
An Apple computer can also use Microsoft Windows through Boot Camp.
Apple iPhone and iPad
Knowing the version of the Apple iOS operating system on your iPhone or iPad help research and resolve issues that are specific to an iOS version. Follow the steps below to determine the iOS version on your Apple device.
- Access the Settings utility.
- Scroll down and tap the General option.
- Tap the About option.
- The iOS version on the device is listed in the Version line.
Android smartphone and tablet device
There are many different devices, including smartphones and tablets, that use the Android operating system. Follow the steps below to determine the version of Android OS (operating system) on your Android device.
- Access the Settings utility.
- Find and tap the About phone or About device option.
- The version of Android OS is listed below the Android version entry.
Related information
- How to find information about my computer.
- How to determine the version of Windows on a computer.
- See our operating system and version definitions for further information and related links.
- Operating system help and support.