- 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
- Checking linux version ubuntu
- How to check Debian version: the quick and easy way
- How to check your Ubuntu version: a guide
- How to delete a Linux directory
- How to delete files in Linux
- How to use the Linux find command
- Checking linux version ubuntu
- How to check your Linux version: easy ways to view the distribution and version number
- How to check Debian version: the quick and easy way
- Lubuntu — The fast and lean Linux distribution
- Xubuntu: the Linux distribution for maximum performance
- Ubuntu backups: A step-by-step guide
- How to Check Ubuntu Version in Command Line
- How to check Ubuntu version?
- Check how long your system is supported
- Get only the Ubuntu version or release name
- Other ways to check Ubuntu version
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.
Checking linux version ubuntu
How to check Debian version: the quick and easy way
Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.
How to check your Ubuntu version: a guide
Knowing which Ubuntu version you’re running is helpful for different things. You can use this information to check whether programs are compatible with your system. Or you can include the version number in troubleshooting searches. It’s thus of crucial importance to know how to check your Ubuntu version. Keep reading to find out how to do so in a few simple clicks.
How to delete a Linux directory
Sometimes you may need to delete an entire folder rather than just individual files. If you want to remove a Linux directory, there are several ways to do it. Here are a few basic solutions that use either File Manager or Terminal. We also explain what you can do if you don’t have the necessary rights.
How to delete files in Linux
Deleting files in Linux couldn’t be easier. Whether you use the file manager or work directly in the terminal with the command “rm”, you can remove Linux files in just a few clicks. Keep reading to find out how to remove single files, multiple files, files of a certain type, or entire folders.
How to use the Linux find command
While working on a Linux system the command line is frequently used. Many administrative tasks require you to find files and directories based on specific criteria. In doing so, Linux admins are accustomed to using the find command. Here, we’ll show you how the command works and how to use it as a handy tool.
Checking linux version ubuntu
How to check your Linux version: easy ways to view the distribution and version number
You can find your current Linux version and distribution in a few easy steps. This information is crucial when it comes to updates, tools, and troubleshooting. Keep reading to find out how to check your Linux version and distribution.
How to check Debian version: the quick and easy way
Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.
Lubuntu — The fast and lean Linux distribution
Lubuntu is an ideal solution for upgrading older computers due to its low hardware and memory requirements. But the Linux distribution is also suitable for other purposes. In our article, we take a closer look at the Ubuntu derivative, who it’s suitable for, and what Lubuntu’s system requirements are. Read on for more.
Xubuntu: the Linux distribution for maximum performance
Xubuntu is a community-developed derivative of the Ubuntu operating system. The distribution is suitable for users who appreciate speed, ease of use, and an elegant look, and want to get the most out of their laptops, desktops, or netbooks. In this article we take a look at Xubuntu’s advantages and system requirements.
Ubuntu backups: A step-by-step guide
It’s important to regularly make backups in Ubuntu. That’s the best way to protect yourself from accidents like the loss of data or a system crash. We’ll explain how to carry out a backup in Ubuntu, what you’ll need, and how you can schedule backups for later. We also touch on solutions for server backups in Ubuntu. Read on for more.
How to Check Ubuntu Version in Command Line
Knowing your Ubuntu version is helpful in several situations. If you are adding an external repository for additional packages or if you want to know whether a certain program version is available for your Ubuntu install or not. Or, if you simply seeking help in Linux forums and you need to provide the information on your Ubuntu version.
Whatever may be the reason, it’s always good to know the basic information about the system you are using.
How to check Ubuntu version?
The easiest way to check the Ubuntu version is to use the following command in the terminal:
This gives all the necessary distributions specific information.
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: 22.04 Codename: jammy
You can see the Ubuntu version in the Description or Release line. As you can see in the output above, I am using Ubuntu version 22.04 which is codenamed ‘jammy’.
This codename is also useful, especially when you are adding an external repository that needs the codename of the Ubuntu release.
Now that you know how to show Ubuntu version in CLI, let me share a handy tip.
Check how long your system is supported
The LTS in the description means that this is a long-term support (LTS) release. The LTS release is supported for five years from its release. You can see how long your current Ubuntu system will be supported with the following command:
As you can see in the screenshot above, my Ubuntu system is supported till April 2027 (4/2027).
Get only the Ubuntu version or release name
The command lsb_release -a gives you 5 lines of output in two columns.
It’s not convenient to use this information in a script or command. The good thing here is that you don’t need to do any ninja stuff to format the output with grep and cut command. There is a shorter version to give you the exact necessary detail.
To get just the Ubuntu version number, combine the s (short) and d (description) options:
Similarly, to get just the Ubuntu codename, combine the s and c (codename) options:
You can see the outputs in the screenshot below:
This is more appropriate to be used in the scripts, right?
Other ways to check Ubuntu version
While lsb_release -a is my preferred way to get the Ubuntu version details; it’s not the only way. There are other commands that provide you with this information.
You can use the hostnamectl command:
You can see the Ubuntu version detail in the output but no codename:
Static hostname: learnubuntu Icon name: computer-vm Chassis: vm Machine ID: c022d7fa917ec36bb318f777628c6940 Boot ID: a2fe9f564a424550bf5db043ce94bdce Virtualization: kvm Operating System: Ubuntu 22.04 LTS Kernel: Linux 5.15.0-25-generic Architecture: x86-64 Hardware Vendor: DigitalOcean Hardware Model: Droplet
You get additional details such as whether it’s a physical or virtual system, kernel version, and CPU architecture. From the output, you can surmise that I am using a VM on DigitalOcean.
Another way to get the Ubuntu version detail is to read the content of file /etc/os-release:
This gives plenty of information in addition to the codename and version name:
PRETTY_NAME="Ubuntu 22.04 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04 (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian 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" UBUNTU_CODENAME=jammy
So, you learned various ways to find the version of Ubuntu installed on your system. The command-line methods work everywhere, be it Ubuntu running in WSL or AWS.
Let me know if you have any questions.