1) linux-zopi:~ # cat /proc/version
Linux version 2.6.37.1-1.2-desktop (geeko@buildhost) (gcc version 4.5.1 20101208 [gcc-4_5-branch revision 167585] (SUSE Linux) ) #1 SMP PREEMPT 2011-02-21 10:34:10 +0100
2) linux-zopi:~ # uname -a
Linux linux-zopi 2.6.37.1-1.2-desktop #1 SMP PREEMPT 2011-02-21 10:34:10 +0100 i686 i686 i386 GNU/Linux
3) linux-zopi:~ # uname -r
2.6.37.1-1.2-desktop
2. 查看Linux版本:
1) 登录到服务器执行 lsb_release -a ,即可列出所有版本信息,如:
linux-zopi:~ # lsb_release -a
LSB Version: n/a
Distributor ID: SUSE LINUX
Description: openSUSE 11.4 (i586)
Release: 11.4
Codename: Celadon
注:这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。
2) 登录到linux执行cat /etc/issue,如:
linux-zopi:~ # cat /etc/issue
Welcome to openSUSE 11.4 "Celadon" - Kernel \r (\l).
3) 登录到linux执行cat /etc/SuSE-release,如:
linux-zopi:~ # cat /etc/SuSE-release
openSUSE 11.4 (i586)
VERSION = 11.4
CODENAME = Celadon
注:在RedHat中此命令为“cat /etc/redhat-release”。
另外在Redhat Linux中还有如下查询命令:
4) 登录到linux执行rpm -q redhat-release,如:
[root@q1test01 ~]# rpm -q redhat-release
redhat-release-4AS-3
注:这种方式下可看到一个所谓的release号,比如上边的例子是3
这个release号和实际的版本之间存在一定的对应关系,如下:
redhat-release-3AS-1 -> Redhat Enterprise Linux AS 3
redhat-release-3AS-7.4 -> Redhat Enterprise Linux AS 3 Update 4
redhat-release-4AS-2 -> Redhat Enterprise Linux AS 4
redhat-release-4AS-2.4 -> Redhat Enterprise Linux AS 4 Update 1
redhat-release-4AS-3 -> Redhat Enterprise Linux AS 4 Update 2
redhat-release-4AS-4.1 -> Redhat Enterprise Linux AS 4 Update 3
redhat-release-4AS-5.5 -> Redhat Enterprise Linux AS 4 Update 4