首页 > 代码库 > 找出Linux的名称,版本以及内核详细

找出Linux的名称,版本以及内核详细

This short tutorial is intended to help newbies who don’t know how to find out the Linux distribution name, version and kernel details via command line.

Method 1 – Distribution & Version Details  

Command:

cat /etc/*-release

 

Sample Output On CentOS 6.4:

CentOS release 6.4 (Final)

 

Sample Output On Ubuntu 13.04:

DISTRIB_ID=UbuntuDISTRIB_RELEASE=13.04DISTRIB_CODENAME=raringDISTRIB_DESCRIPTION="Ubuntu 13.04"NAME="Ubuntu"VERSION="13.04, Raring Ringtail"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 13.04"VERSION_ID="13.04"HOME_URL="http://www.ubuntu.com/"SUPPORT_URL="http://help.ubuntu.com/"BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

 

Sample Output On Debian 7:

PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"NAME="Debian GNU/Linux"VERSION_ID="7"VERSION="7 (wheezy)"ID=debianANSI_COLOR="1;31"HOME_URL="http://www.debian.org/"SUPPORT_URL="http://www.debian.org/support/"BUG_REPORT_URL="http://bugs.debian.org/"

 

     Method 2 –      Distribution & Version Details      

Command:

lsb_release -a

 

Sample Output On Debian 7:

No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 7.1 (wheezy)
Release:    7.1
Codename:    wheezy

 

Sample Output On Ubuntu 13.04:

No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 13.04
Release:    13.04
Codename:    raring

 

Method 3 – Finding Kernel Version  

Command:

cat /proc/version

 

Sample Output On CentOS 6.4:

Linux version 2.6.32-358.11.1.el6.centos.plus.i686 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Wed Jun 12 17:07:23 UTC 2013

 

Sample Output On Debian 7:

Linux version 3.2.0-4-486 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 Debian 3.2.46-1

 

Sample Output On Ubuntu 13.04:

Linux version 3.8.0-29-generic (buildd@roseapple) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #42-Ubuntu SMP Tue Aug 13 19:40:39 UTC 2013

 

Method 4 – Finding Kernel Version  

Command:

uname -a

 

Sample Output On CentOS 6.4:

Linux server.unixmen.com 2.6.32-358.11.1.el6.centos.plus.i686 #1 SMP Wed Jun 12 17:07:23 UTC 2013 i686 i686 i386 GNU/Linuxm

 

Sample output On Debian 7:

Linux server 3.2.0-4-486 #1 Debian 3.2.46-1 i686 GNU/Linux

 

Sample Output On Ubuntu 13.04:

Linux sk 3.8.0-29-generic #42-Ubuntu SMP Tue Aug 13 19:40:39 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

 

Method 5 – Finding Distribution Name  

Command:

cat /etc/redhat-release

 

Sample Output On CentOS 6.4/RHEL 6.4:

CentOS release 6.4 (Final)

 

Method 6 – Finding Distribution version  

Command:

cat /etc/debian_version

 

Sample Output On Debian 7:

7.1

 

Sample Output On Ubuntu 13.04:

wheezy/sid

 

     Method 7 – Finding Distribution name & Version      
   
 

Command:

cat /etc/issue

 

Sample Output On Ubuntu 13.04:

Ubuntu 13.04 \n \l

 

Sample Output On Debian 7:

Debian GNU/Linux 7 \n \l

 

Sample Output On CentOS 6.4:

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

 

For other distributons  

I didn’t not check the following commands yet, because i don’t have the respective systems at the time writing this. I gathered these details on various websites. Hope it helps you.

Novel SUSE:

cat /etc/SuSE-release

 

Fedora:

cat /etc/fedora-release

 

Slackware:

cat /etc/slackware-release
cat /etc/slackware-version

 

Mandrake:

cat /etc/mandrake-release

 

Yellow dog:

cat /etc/yellowdog-release

 

Sun JDS:

cat /etc/sun-release

 

Solaris/Sparc:

cat /etc/release

 

Gentoo:

cat  /etc/gentoo-release