How to use Linux command to know if the system is Ubuntu or Redhat or other system?

Source: Internet
Author: User

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.