How to Check Linux Version Quickly and Easily
To check your Linux version, use the
cat /etc/os-release command for detailed OS info or uname -r to see the kernel version. These commands show your Linux distribution and version quickly in the terminal.Syntax
Here are the main commands to check Linux version:
cat /etc/os-release: Shows detailed Linux distribution info.uname -r: Displays the Linux kernel version.lsb_release -a: Provides distribution info if available.
bash
cat /etc/os-release uname -r lsb_release -a
Example
This example runs the commands to show the Linux version and kernel details.
bash
cat /etc/os-release uname -r
Output
NAME="Ubuntu"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 22.04.2 LTS"
VERSION_ID="22.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=jammy
UBUNTU_CODENAME=jammy
5.15.0-76-generic
Common Pitfalls
Some common mistakes when checking Linux version:
- Using
unamealone shows only the kernel, not the distribution. lsb_releasemay not be installed by default on all distros.- Trying to read files like
/etc/issuemay show less detailed or customized info.
bash
uname # This shows only the kernel name, not version or distro # Correct way: uname -r
Quick Reference
| Command | Description |
|---|---|
| cat /etc/os-release | Shows detailed Linux distribution info |
| uname -r | Displays Linux kernel version |
| lsb_release -a | Shows distribution info if available |
| cat /etc/issue | Shows basic distro info, may be customized |
Key Takeaways
Use
cat /etc/os-release for detailed Linux distribution info.Use
uname -r to check the kernel version quickly.lsb_release -a is useful but may not be installed on all systems.Avoid using
uname without options as it shows limited info.Check multiple commands if you need full details about your Linux version.