1. 程式人生 > >CentOS 7檢視系統版本及檢視機器位數x86-64 & centOS7下實踐查詢版本/CPU/記憶體/硬碟容量等硬體資訊

CentOS 7檢視系統版本及檢視機器位數x86-64 & centOS7下實踐查詢版本/CPU/記憶體/硬碟容量等硬體資訊

http://www.linuxidc.com/Linux/2016-11/137550.htm

http://blog.csdn.net/dream_broken/article/details/52883883

前言

記下CentOS 7檢視系統版本及檢視機器位數x86-64的方法,由於不經常使用Linux,每當使用的時候就是安裝軟體,安裝軟體的時候就要選擇安裝包平臺,是32位的還是64位的。這時候突然發現不知道怎麼查,於是百度。雖然輕而易舉百度出來,但仍舊沒有自己的筆記看起來舒服。所以,還是記錄下來。

辨識標準

首先要清楚什麼樣標識是32位的,什麼樣的是64位的。

PC server X86 系列

I386--I686 都是32位

x86_64 是 64位

檢視位數命令

命令實在是不要太多,為了防止選擇性障礙,一致選擇第一種方式,後面的僅作為補充。
方法1:

[[email protected] ~]# uname -a
Linux linuxidc 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

方法2:顯示系統程式資訊

[[email protected] ~]# file /bin/ls
/bin/ls: ELF 64
-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped

方法3:

[[email protected] ~]# cat /proc/version
Linux version 3.10.0-327.18.2.el7.x86_64 ([email protected]) (gcc version 4.8
.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016

方法4:

(32位的系統中int型別和long型別一般都是4位元組,64位的系統中int型別還是4位元組的,但是long已變成了8位元組inux系統中可用"getconf WORD_BIT"和
"getconf LONG_BIT"獲得word和long的位數。64位系統中應該分別得到32和64。)

[[email protected] ~]# getconf LONG_BIT
64

檢視系統版本

方法1:《這個命令試過不好用》

[[email protected] ~]#  lsb_release -aLSBVersion:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarchDistributorID: CentOSDescription:    CentOSLinuxrelease 7.2.1511 (Core) 
Release:    7.2.1511Codename:   Core

方法2:


[[email protected] ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE=
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
RedHat_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

方法3:

[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

方法4:

[[email protected] ~]# rpm -q centos-release
centos-release-7-2.1511.el7.centos.2.10.x86_64
方法5:檢視系統版本

cat /etc/redhat-release

這裡寫圖片描述

檢視核心版本

方法1:

[[email protected] ~]# cat /proc/version
Linux version 3.10.0-327.18.2.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016

方法2:

[[email protected] ~]# uname -a
Linux linuxidc 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

---------------------------------

1.系統

  1.1版本

  uname -a 能確認是64位還是32位,其它的資訊不多

  1. [[email protected] ~]# uname -a  
  2. Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux  
  more /etc/*release 可以看到更多資訊
  1. [[email protected] ~]# more /etc/*release  
  2. ::::::::::::::  
  3. /etc/centos-release  
  4. ::::::::::::::  
  5. CentOS Linux release 7.2.1511 (Core)   
  6. ::::::::::::::  
  7. /etc/os-release  
  8. ::::::::::::::  
  9. NAME="CentOS Linux"
  10. VERSION="7 (Core)"
  11. ID="centos"
  12. ID_LIKE="rhel fedora"
  13. VERSION_ID="7"
  14. PRETTY_NAME="CentOS Linux 7 (Core)"
  15. ANSI_COLOR="0;31"
  16. CPE_NAME="cpe:/o:centos:centos:7"
  17. HOME_URL="https://www.centos.org/"
  18. BUG_REPORT_URL="https://bugs.centos.org/"
  19. CENTOS_MANTISBT_PROJECT="CentOS-7"
  20. CENTOS_MANTISBT_PROJECT_VERSION="7"
  21. REDHAT_SUPPORT_PRODUCT="centos"
  22. REDHAT_SUPPORT_PRODUCT_VERSION="7"
  23. ::::::::::::::  
  24. /etc/redhat-release  
  25. ::::::::::::::  
  26. CentOS Linux release 7.2.1511 (Core)   
  27. ::::::::::::::  
  28. /etc/system-release  
  29. ::::::::::::::  
  30. CentOS Linux release 7.2.1511 (Core)   

  1.2核數

    cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c     
  1. [[email protected] ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c  
  2.       1  Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz  
   1個邏輯CPU,i5型等資訊
  1. [[email protected] ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c  
  2.       8  Intel(R) Xeon(R) CPU E7-4820 v2 @ 2.00GHz  
   8個邏輯CPU

  cat /proc/cpuinfo | grep physical | uniq -c
  1. [[email protected] ~]# cat /proc/cpuinfo | grep physical | uniq -c  
  2.       1 physical id     : 0  
  3.       1 address sizes   : 42 bits physical, 48 bits virtual  
  實際上是一顆一核的CPU
  1. [[email protected] ~]# cat /proc/cpuinfo | grep physical | uniq -c  
  2.       1 physical id     : 0  
  3.       1 address sizes   : 40 bits physical, 48 bits virtual  
  4.       1 physical id     : 0  
  5.       1 address sizes   : 40 bits physical, 48 bits virtual  
  6.       1 physical id     : 0  
  7.       1 address sizes   : 40 bits physical, 48 bits virtual  
  8.       1 physical id     : 0  
  9.       1 address sizes   : 40 bits physical, 48 bits virtual  
  10.       1 physical id     : 0  
  11.       1 address sizes   : 40 bits physical, 48 bits virtual  
  12.       1 physical id     : 0  
  13.       1 address sizes   : 40 bits physical, 48 bits virtual  
  14.       1 physical id     : 0  
  15.       1 address sizes   : 40 bits physical, 48 bits virtual  
  16.       1 physical id     : 0  
  17.       1 address sizes   : 40 bits physical, 48 bits virtual  
  由8個1核的CPU組成8核

  cat /proc/cpuinfo可以看到更為詳細的資訊
  1. [[email protected] ~]# cat /proc/cpuinfo  
  2. processor       : 0  
  3. vendor_id       : GenuineIntel  
  4. cpu family      : 6  
  5. model           : 94  
  6. model name      : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz  
  7. stepping        : 3  
  8. microcode       : 0x74  
  9. cpu MHz         : 2304.004  
  10. cache size      : 6144 KB  
  11. physical id     : 0  
  12. siblings        : 1  
  13. core id         : 0  
  14. cpu cores       : 1  
  15. apicid          : 0  
  16. initial apicid  : 0  
  17. fpu             : yes  
  18. fpu_exception   : yes  
  19. cpuid level     : 22  
  20. wp              : yes  
  21. flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm hwp hwp_noitfy hwp_act_window hwp_epp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt xsavec xgetbv1 xsaves  
  22. bogomips        : 4608.00  
  23. clflush size    : 64  
  24. cache_alignment : 64  
  25. address sizes   : 4