Bash Command to Find OS Version in Terminal

In order to know what version of OS you are running, you can make use of the below commands on the Bash Terminal based on your operating system.

Debian/Ubuntu Linux:

# lsb_release -a 

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04

CentOS/RHEL Linux:

# cat /etc/redhat-release

Red Hat Enterprise Linux Server release 7.9 (Maipo)

Other Linux/Unix-Like Systems:

# uname -a

Linux b9fc21f2fc40 5.15.49-linuxkit-pr #1 SMP PREEMPT Thu May 25 07:27:39 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux


# uname -a

macOS Bash Shell Know OS Version Number Example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap