View system information such as the version number of Linux systems such as Ubuntu/Redhat

The first method:
# lsb_release -a
LSB Version: :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID : CentOS
Description: CentOS release 5.7 (Final)
Release: 5.7
Codename: Final

This command applies to all linux that comply with the LSB specification, including Redhat, SuSE, Debian, Ubuntu, Centos and other distributions.

Although the following commands cannot view the current system name and version, they can display the system core information.
root@MyMail ~ # uname
Linux
root@MyMail ~ # uname -r
2.6.18-164.el5
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14 :58:35 EDT 2010 i686 i686 i386 GNU/Linux

The following two methods are applicable to RedHat, CentOS

root@MyMail ~ # cat /etc/redhat-release
CentOS release 5.7 (Final)

Log in to linux and execute rpm -q redhat-release

#rpm -q redhat-release
or CentOS

root@MyMail ~ # rpm -q centos-release centos
-release-5-7.el5.centos.1

Four methods:

the command of the current centos version and the version corresponding to redhat

This command is not accurate under centos, and the displayed system and version are also Red Hat 3.4.6-10.

# cat /proc/version
Linux version 2.6.9-78.ELsmp ([email protected]) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)) #1 SMP Fri Jul 25 00:04 :28 EDT 2008

and this command is used on Ubuntu, it can be seen in the display that it is Ubuntu, but the version cannot be seen.

The last method:

#cat /etc/issue

is executed under CentOS as:

CentOS release 5.7 (Final)
Kernel \r on an \m


or under Ubuntu as:

Ubuntu 11.04 \n \l


You can view the version number of the currently running Ubuntu.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326876935&siteId=291194637