What is the Linux command to check the server OS and its version?
I am connected to the server using shell.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Kernel Version
If you want kernel version information, use uname(1). For example:
$ uname -a Linux localhost 3.11.0-3-generic #8-Ubuntu SMP Fri Aug 23 16:49:15 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Distribution Information
If you want distribution information, it will vary depending on your distribution and whether your system supports the Linux Standard Base. Some ways to check, and some example output, are immediately below.
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu Saucy Salamander (development branch) Release: 13.10 Codename: saucy $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.10 DISTRIB_CODENAME=saucy DISTRIB_DESCRIPTION="Ubuntu Saucy Salamander (development branch)" $ cat /etc/issue.net Ubuntu Saucy Salamander (development branch) $ cat /etc/debian_version wheezy/sid
Method 2
You can execute cat /etc/redhat-release to check the Red Hat Linux (RH) version if you use an RH-based OS.
Another solution that may work on any linux distributions is lsb_release -a.
And the uname -a command shows the kernel version and other things.
Also cat /etc/issue.net shows your OS version… This file shows in the telnet command when you want to connect to the server. For security reasons, it is better to delete the version and os name in this file.
Method 3
If it is a debian based system, you could do
cat /etc/*_version
or for a Red Hat or CentOS based system, you could try (this is working on Red Hat Enterprise Linux-7):
cat /etc/*-release
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0