{"id":9245,"date":"2026-04-09T18:20:12","date_gmt":"2026-04-09T18:20:12","guid":{"rendered":"https:\/\/commandlinux.com\/?p=9245"},"modified":"2026-04-10T08:27:37","modified_gmt":"2026-04-10T08:27:37","slug":"check-linux-version","status":"publish","type":"post","link":"https:\/\/commandlinux.com\/qa\/check-linux-version\/","title":{"rendered":"How to Check Linux Version"},"content":{"rendered":"\n<style>\n\ncode { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 0.88em; background: #f4f4f4; border: 1px solid #e5e5e5; border-radius: 4px; padding: 2px 6px; color: #c7254e; }\npre { background: #f7f7f7; border: 1px solid #e5e5e5; border-radius: 6px; padding: 1rem 1.25rem; margin: 0.75rem 0 1.25rem; overflow-x: auto; }\npre code { background: none; border: none; padding: 0; font-size: 0.9rem; color: #2d2d2d; }\n.check-linux-version-container  table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.93rem; }\n.check-linux-version-container  th { background: #f5f5f5; font-weight: 600; text-align: left; padding: 9px 14px; border: 1px solid #e0e0e0; color: #333; }\n.check-linux-version-container  td { padding: 8px 14px; border: 1px solid #e0e0e0; vertical-align: top; }\ntr:nth-child(even) td { background: #fafafa; }\n.check-linux-version-container  a { color: #1a6fb8; text-decoration: none; }\na:hover { text-decoration: underline; }\n.chart-wrap { margin: 1.5rem 0; }\n.chart-title { font-size: 0.85rem; color: #555; margin-bottom: 0.75rem; font-weight: 500; }\n.compat-grid { display: grid; grid-template-columns: 180px repeat(5, 1fr); gap: 1px; background: #e0e0e0; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; font-size: 0.82rem; }\n.compat-grid > div { background: #fff; padding: 7px 10px; text-align: center; }\n.compat-grid .hdr { background: #f2f2f2; font-weight: 600; color: #333; text-align: center; }\n.compat-grid .cmd-label { text-align: left; font-weight: 500; color: #222; background: #fafafa; }\n.yes { color: #2e7d32; font-weight: 600; }\n.partial { color: #e65100; font-weight: 600; }\n.no { color: #b71c1c; font-weight: 600; }\n.faq-section h2 { margin-top: 2.5rem; }\n.faq-section h3 { margin: 1.25rem 0 0.35rem; }\n.faq-section p { margin-bottom: 0.5rem; }\n<\/style>\n\n<p>Whether you are setting up a new server, troubleshooting a package conflict, or verifying compatibility before an update, knowing how to check the Linux version on your system is something you will need more than once. The answer depends on what you are actually looking for \u2014 the distribution name, its release number, or the kernel beneath it. These are separate things, and different commands return different parts of that picture.<\/p>\n\n<h2>What &#8220;Linux Version&#8221; Actually Means<\/h2>\n<p>The phrase &#8220;Linux version&#8221; covers two different things. Your distribution \u2014 Ubuntu, Fedora, Debian, Mint, or RHEL \u2014 is the named OS package with its own release schedule and software repositories. The kernel is the underlying software layer that manages hardware, separate from the distribution name entirely.<\/p>\n<p>A command like <code>uname -r<\/code> only returns kernel data. <code>lsb_release -a<\/code> returns distribution details. Some commands show both at once. Knowing which one you need saves time and avoids running the wrong tool.<\/p>\n\n<h2>How to Check Linux Version: Six Methods<\/h2>\n<p>There are six reliable ways to check the Linux OS version or kernel from the command line. Which one works best depends on your distribution and what information you need.<\/p>\n\n<div class=\"chart-wrap\">\n<div class=\"chart-title\">Command compatibility across major Linux distributions<\/div>\n<div class=\"compat-grid\">\n  <div class=\"hdr\">Command<\/div>\n  <div class=\"hdr\">Ubuntu<\/div>\n  <div class=\"hdr\">Debian<\/div>\n  <div class=\"hdr\">Fedora<\/div>\n  <div class=\"hdr\">RHEL<\/div>\n  <div class=\"hdr\">Alpine<\/div>\n  <div class=\"cmd-label\"><code>lsb_release -a<\/code><\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"partial\">Install<\/div>\n  <div class=\"no\">No<\/div>\n  <div class=\"cmd-label\"><code>cat \/etc\/os-release<\/code><\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"cmd-label\"><code>uname -r<\/code><\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"cmd-label\"><code>hostnamectl<\/code><\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"no\">No<\/div>\n  <div class=\"cmd-label\"><code>cat \/etc\/issue<\/code><\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"partial\">Varies<\/div>\n  <div class=\"partial\">Varies<\/div>\n  <div class=\"partial\">Varies<\/div>\n  <div class=\"cmd-label\"><code>cat \/proc\/version<\/code><\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n  <div class=\"yes\">Yes<\/div>\n<\/div>\n<\/div>\n\n<h3>1. Check Linux Version with lsb_release<\/h3>\n<pre><code>lsb_release -a<\/code><\/pre>\n<p>LSB stands for Linux Standard Base. This command returns the distributor ID, description, release number, and codename in a single output. It works across Ubuntu, Debian, Fedora, and most common distributions without additional configuration.<\/p>\n<p>If the command is not found, the tool is not installed by default on that system. The <a href=\"https:\/\/commandlinux.com\/man-page\/man1\/lsb_release\/\" target=\"_blank\" rel=\"noopener\">full list of available output flags<\/a> documents how to filter for individual fields if you only need the release number or distributor ID. Not all distributions ship it, so having a fallback is worth knowing.<\/p>\n\n<h3>2. Check Linux Version Using \/etc\/os-release<\/h3>\n<pre><code>cat \/etc\/os-release<\/code><\/pre>\n<p>This file exists on nearly every modern Linux system and outputs structured data: OS name, version, ID, and additional metadata. It works on Ubuntu, Debian, Fedora, Red Hat, CentOS, and Alpine without needing any extra tools installed, which makes it one of the most portable options.<\/p>\n<p>The <a href=\"https:\/\/www.commandlinux.com\/man-page\/man5\/os-release.5.html\" target=\"_blank\" rel=\"noopener\">os-release file format specification<\/a> documents each variable in detail, useful when you need to parse specific fields inside a shell script. If <code>lsb_release<\/code> is unavailable, start here.<\/p>\n\n<h3>3. Check Linux Kernel Version with uname<\/h3>\n<pre><code>uname -a<\/code><\/pre>\n<p>This returns a full line of system information covering the kernel name, hostname, kernel release number, compile date, and CPU architecture. To get just the kernel version, use the shorter form:<\/p>\n<pre><code>uname -r<\/code><\/pre>\n<p>Here is what each field in <code>uname -a<\/code> output means:<\/p>\n<table>\n  <tr><th>Field<\/th><th>Example Value<\/th><th>Meaning<\/th><\/tr>\n  <tr><td>Kernel name<\/td><td>Linux<\/td><td>The kernel type<\/td><\/tr>\n  <tr><td>Hostname<\/td><td>server01<\/td><td>Machine name<\/td><\/tr>\n  <tr><td>Kernel release<\/td><td>5.14.0-162.el9.x86_64<\/td><td>Kernel version number<\/td><\/tr>\n  <tr><td>Compile info<\/td><td>#1 SMP Tue Nov 15 2022<\/td><td>When the kernel was built<\/td><\/tr>\n  <tr><td>Architecture<\/td><td>x86_64<\/td><td>CPU type (64-bit)<\/td><\/tr>\n  <tr><td>OS<\/td><td>GNU\/Linux<\/td><td>Full OS name<\/td><\/tr>\n<\/table>\n<p>The <a href=\"https:\/\/www.commandlinux.com\/man-page\/man1\/uname.1.html\" target=\"_blank\" rel=\"noopener\">complete uname flag reference<\/a> covers every available option, including <code>-m<\/code> for machine hardware type and <code>-p<\/code> for processor architecture \u2014 both useful when selecting the right software package to download.<\/p>\n\n<h3>4. Using hostnamectl to Check Linux Version<\/h3>\n<pre><code>hostnamectl<\/code><\/pre>\n<p>On Systemd-based systems, this is the fastest single command for seeing both the OS distribution name and kernel version together. Look for the &#8220;Operating System&#8221; and &#8220;Kernel&#8221; lines in the output. It pulls from Systemd logs tied to the machine&#8217;s hostname.<\/p>\n<p>The documentation for <a href=\"https:\/\/commandlinux.com\/man-page\/hostnamectl\/\" target=\"_blank\" rel=\"noopener\">controlling the system hostname<\/a> explains additional subcommands for querying and setting hostname-related settings. One limitation: this command does not work on older distributions or systems that do not use Systemd as their init system.<\/p>\n\n<h3>5. Using the \/etc\/issue File<\/h3>\n<pre><code>cat \/etc\/issue<\/code><\/pre>\n<p>This file contains the message shown to users before a login prompt. It usually holds a short OS identification string \u2014 a quick read when you do not need full distribution metadata. The output is brief but consistent on most systems.<\/p>\n<p>On some distributions, <code>\/etc\/issue<\/code> contains placeholder text rather than actual version data. In those cases, <code>\/etc\/os-release<\/code> is the more reliable choice.<\/p>\n\n<h3>6. Using cat \/proc\/version<\/h3>\n<pre><code>cat \/proc\/version<\/code><\/pre>\n<p>This reads directly from the proc virtual filesystem and combines content from three kernel files: ostype, osrelease, and version. The output includes the kernel version and build metadata \u2014 a solid fallback when other commands are unavailable, since it works regardless of what is installed on the system.<\/p>\n<p>The <a href=\"https:\/\/commandlinux.com\/man-page\/man1\/cat.1.html\/\" target=\"_blank\" rel=\"noopener\">cat command reference for concatenating files to standard output<\/a> covers how to chain file reads and filter output in scripts, which is practical when pulling data from multiple proc entries at once.<\/p>\n\n<h2>Quick Reference: Linux Version Commands<\/h2>\n<table>\n  <tr><th>Goal<\/th><th>Command<\/th><\/tr>\n  <tr><td>See both OS name and kernel<\/td><td><code>hostnamectl<\/code><\/td><\/tr>\n  <tr><td>Distribution details with codename<\/td><td><code>lsb_release -a<\/code><\/td><\/tr>\n  <tr><td>Standard OS info file<\/td><td><code>cat \/etc\/os-release<\/code><\/td><\/tr>\n  <tr><td>Kernel version only<\/td><td><code>uname -r<\/code><\/td><\/tr>\n  <tr><td>All kernel details<\/td><td><code>uname -a<\/code><\/td><\/tr>\n  <tr><td>Kernel from proc filesystem<\/td><td><code>cat \/proc\/version<\/code><\/td><\/tr>\n  <tr><td>Very old systems<\/td><td><code>cat \/etc\/*release<\/code><\/td><\/tr>\n<\/table>\n\n<div class=\"faq-section\">\n<h2>FAQs<\/h2>\n\n<h3>What is the fastest command to check the Linux version?<\/h3>\n<p>On Systemd-based systems, <code>hostnamectl<\/code> returns both the OS name and kernel version in one output. On any distribution, <code>cat \/etc\/os-release<\/code> is the most portable single command and requires no additional tools.<\/p>\n\n<h3>How do I check the Linux kernel version only?<\/h3>\n<p>Run <code>uname -r<\/code> in the terminal. It outputs only the kernel release number, such as <code>5.15.0-91-generic<\/code>. For the full kernel line including architecture and build date, use <code>uname -a<\/code> instead.<\/p>\n\n<h3>How do I check the Linux version without lsb_release?<\/h3>\n<p>Use <code>cat \/etc\/os-release<\/code>, which works on virtually all modern distributions without any tool installed. On very old systems where that file is absent, try <code>cat \/etc\/*release<\/code> or <code>cat \/proc\/version<\/code> as fallbacks.<\/p>\n\n<h3>Can I check the Linux OS version remotely over SSH?<\/h3>\n<p>Yes. SSH into the remote machine and run any of the standard commands \u2014 <code>uname -r<\/code>, <code>cat \/etc\/os-release<\/code>, or <code>hostnamectl<\/code>. Ensure you have authentication credentials and sufficient access permissions before connecting.<\/p>\n\n<h3>What is the difference between the Linux distribution version and kernel version?<\/h3>\n<p>The distribution version identifies the named OS release, such as Ubuntu 22.04 or Fedora 39. The kernel version is a separate number identifying the core software layer managing hardware. Both change independently on their own release schedules.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to check your Linux version for server setup, troubleshooting package conflicts, and ensuring compatibility before updates. A quick, essential skill you\u2019ll use again and again on any system.<\/p>\n","protected":false},"author":1,"featured_media":9246,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-9245","post","type-post","status-publish","format-standard","has-post-thumbnail","category-qa"],"_links":{"self":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/9245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/comments?post=9245"}],"version-history":[{"count":2,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/9245\/revisions"}],"predecessor-version":[{"id":9248,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/9245\/revisions\/9248"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media\/9246"}],"wp:attachment":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media?parent=9245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/categories?post=9245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/tags?post=9245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}