1. 程式人生 > >檢視Linux系統版本與位數

檢視Linux系統版本與位數

檢視系統發行版資訊

  • 檢視LSB (Linux Standard Base)本身的版本資訊。
[ray@localhost ~]$ lsb_release -v
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
  • 列印系統發行版的所有資訊,比如發行版的ID,描述資訊,具體版本,代號:
[ray@localhost ~]$ lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1
-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 5.5(Tikanga) Release: 5.5 Codename: Tikanga

有些系統上不一定安裝了這個命令,可以通過檢視/etc/issue檔案得到發行版資訊。

注:centos 7 需要用cat /etc/redhat-release檢視

[ray@localhost ~]$ cat /etc/issue 
Red Hat Enterprise Linux Server release 5.5
(Tikanga) Kernel \r on an \m   [ray@localhost ~]$ head-1/etc/issue Red Hat Enterprise Linux Server release 5.5(Tikanga)   [ray@localhost ~]$ uname-r 2.6.18-194.el5   [ray@localhost ~]$ uname-a Linux localhost 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux   [ray@localhost ~]$ cat
/proc/version Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com)(gcc version 4.1.2 20080704(Red Hat 4.1.2-48))#1 SMP Tue Mar 16 21:52:43 EDT 2010

檢視系統是64位還是32位

uname -m
 
[ray@localhost ~]$ getconf LONG_BIT
32[ray@localhost ~]$ getconf WORD_BIT
32[ray@localhost ~]$ file/bin/ls/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1(SYSV), for GNU/Linux 2.6.9,
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

如果有x86_64就是64位的,沒有就是32位的。

下面是64位的 :

Linux WORKS 2.6.9-11.ELsmp #1 SMP Fri May 20 18:25:30 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux

32位的:

Linux backup 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:58:04 EST 2007 i686 i686 i386 GNU/Linux

注意:Ixxx的全是32位的,有X86—64的全是64位。可輸入uname –m或arch檢視。