1, 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 versions of Linux that comply with the LSB specification, including Redhat, SuSE, Debian, Ubuntu, CentOS, and other distributions.
The next command cannot view the current system name and version, but it can display system core information.
[Email protected] ~ # uname
Linux
[Email protected] ~ # Uname-r
2.6.18-164.el5
[Email protected] ~]# uname-a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT. i686 i686 i386 Gnu/linux
2. The following two methods apply to Redhat, CentOS
[Email protected] ~ # Cat/etc/redhat-release
CentOS Release 5.7 (Final)
Log on to Linux execution:
#rpm-Q Redhat-release
or CentOS execution:
[Email protected] ~ # Rpm-q Centos-release
Centos-release-5-7.el5.centos.1
3. The fourth method:
Commands for the current version of the CentOS version corresponding to Redhat
This command is not accurate under CentOS, and the system and version shown 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:2 8 EDT 2008
And this command is used on Ubuntu, the display of smart see is Ubuntu, but do not see the version.
4. The last method:
#cat/etc/issue
Under CentOS perform the display as:
CentOS Release 5.7 (Final)
Kernel \ r on an \m
or shown under Ubuntu as:
Ubuntu 11.04 \ \l
Can be used to view the version number of the Ubuntu that is currently running.
How to use Linux command to know if the system is Ubuntu or Redhat or other system?