Introduction: Linux is a free and open source operating system (OS). An OS used to control your desktop/laptop hardware, runs apps, manages users and permissions, and more. It also controls various resources and runs multiple server apps such as Nginx, MySQL, PHP and more.
Command to find of what version of Linux am I running?
- lsb_release -a – Best command to print Linux version
- hostnamectl – See Linux name and version
- cat /etc/*release – Show Linux version and distro info
- uname -a : Display system information
What version of Linux do I have? Find out at command line
Open the terminal application and type the following command to see Linux version:
hostnamectl
Look for “Operating System” in above screen shot. One can use the grep command or egrep command as follows:
hostnamectl | grep "Operating System"
hostnamectl | egrep "(System|Kernel)"
Sample outputs:
Operating System: CentOS Linux 7 (Core) Kernel: Linux 3.10.0-862.14.4.el7.x86_64
Here is another output from my RHEL server/vm running at cloud data center:
$ hostnamectl
Sample outputs:
Static hostname: rhel7-nixcraft Icon name: computer-vm Chassis: vm Machine ID: bfce903b80a54432b8b992b24603144d Boot ID: 97227bae46f8413a946110683f9d5ed1 Virtualization: kvm Operating System: Red Hat Enterprise Linux CPE OS Name: cpe:/o:redhat:enterprise_linux:7.5:GA:server Kernel: Linux 3.10.0-862.14.4.el7.x86_64 Architecture: x86-64
Command to find version of Linux
Another option that works is to issue the lsb_release command:
lsb_release -a
The command indicates that I am using “SUSE Linux Enterprise Server 12 SP3” release 12.3. Here is another output from my Debian server:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.6 (stretch) Release: 9.6 Codename: stretch
What’s the version of my OS?
If above command not working try the following cat command:
$ cat /etc/*release
Here is output from my Fedora Linux box:
Fedora release 28 (Twenty Eight) NAME=Fedora VERSION="28 (Twenty Eight)" ID=fedora VERSION_ID=28 PLATFORM_ID="platform:f28" PRETTY_NAME="Fedora 28 (Twenty Eight)" ANSI_COLOR="0;34" CPE_NAME="cpe:/o:fedoraproject:fedora:28" HOME_URL="https://fedoraproject.org/" SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=28 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=28 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" Fedora release 28 (Twenty Eight) Fedora release 28 (Twenty Eight)
Find Linux Kernel version command
Simply type the following cat command or uname command:
$ uname
$ uname -mrs
$ uname -a
$ cat /proc/version
A note about GUI method
Go to your Linux system settings and and click on details. You will see info as follows:
Conclusion
You just learn various command to get information about your Linux disro.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 5 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Following always worked for me
uname
cat /etc/*issue
For FreeBSD unix uname just works:
uname
freebsd-version
I am Solaris Unix user and uname works on both Linux and Solaris but not showrev:
Since others have added their oses, I am going to add IBM AIX info ;)
oslevel -r
uname -a
lslpp -h bos.rte
Cisco IOS used by core/edge routers and switches:
show version