41-2 Linux查看CPU和内存的配置信息

文章目录

    • Linux查看CPU和内存的配置信息
          • 请看CPU架构
          • Linux查看物理CPU个数、核数、逻辑CPU个数
          • 查看CPU使用率的命令
          • 查看CPU运行在多少位下的命令
          • 查看CPU是否支持64位运算
      • 查看当前操作系统发行版信息
      • 查看机器型号(需要root权限)
      • 查看网卡信息
      • 查看内存信息
      • 查看内存硬件信息
      • 查看网卡硬件信息
      • 查看pci信息,即主板所有硬件槽信息。
      • 查看bios信息

Linux查看CPU和内存的配置信息

请看CPU架构

多个物理CPU,CPU通过总线进行通信,效率比较低,如下:
41-2 Linux查看CPU和内存的配置信息_第1张图片
多核CPU,不同的核通过L2 cache进行通信,存储和外设通过总线与CPU通信,如下:
41-2 Linux查看CPU和内存的配置信息_第2张图片
多核超线程,每个核有两个逻辑的处理单元,两个核共同分享一个核的资源,如下:
41-2 Linux查看CPU和内存的配置信息_第3张图片
物理CPU
实际Server中插槽上的CPU个数
物理cpu数量,可以数不重复的 physical id 有几个

命令:
cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l

CPU核数
一块CPU上面能处理数据的芯片组的数量、比如现在的i5 760,是双核心四线程的CPU、而 i5 2250 是四核心四线程的CPU
一般来说,物理CPU个数×每颗核数就应该等于逻辑CPU的个数,如果不相等的话,则表示服务器的CPU支持超线程技术

命令:
cat /proc/cpuinfo | grep “cores” | uniq

逻辑CPU
Linux用户对 /proc/cpuinfo 这个文件肯定不陌生. 它是用来存储cpu硬件信息的
信息内容分别列出了processor 0 – n 的规格。这里需要注意,如果你认为n就是真实的cpu数的话, 就大错特错了
一般情况,我们认为一颗cpu可以有多核,加上intel的超线程技术(HT), 可以在逻辑上再分一倍数量的cpu core出来
逻辑CPU数量=物理cpu数量 x cpu cores 这个规格值 x 2(如果支持并开启ht)
备注:Linux下top查看的CPU也是逻辑CPU个数

命令:
cat /proc/cpuinfo | grep “processor” | wc -l

注:
1 如果逻辑cpu不等于物理cpu乘以cpu核数,可以断定采用了超线程技术
2 当我们 cat /proc/cpuinfo 时,具有相同core id的CPU是同一个core的超线程,具有相同physical id的CPU是同一个CPU封装的线程或核心

1.拥有相同 physical id 的所有逻辑处理器共享同一个物理插座。每个 physical id 代表一个唯一的物理封装。
2.Siblings 表示位于这一物理封装上的逻辑处理器的数量。它们可能支持也可能不支持超线程(HT)技术。
3.每个 core id 均代表一个唯一的处理器内核。所有带有相同 core id 的逻辑处理器均位于同一个处理器内核上。
4.如果有二个或者两个以上逻辑处理器拥有相同的 core id 和 physical id,则说明系统支持超线程(HT)技术。
5.如果有两个或两个以上的逻辑处理器拥有相同的 physical id,但是 core id 不同,则说明这是一个多内核处理器。cpu cores 条目也可以表示是否支持多内核。

/proc/cpuinfo 文件包含系统上每个处理器的数据段落。/proc/cpuinfo 描述中有 6 个条目适用于多内核和超线程(HT)技术检查:processor, vendor id, physical id, siblings, core id 和 cpu cores。

processor 条目包括这一逻辑处理器的唯一标识符。
physical id 条目包括每个物理封装的唯一标识符。
core id 条目保存每个内核的唯一标识符。
siblings 条目列出了位于相同物理封装中的逻辑处理器的数量。 #siblings 英文译:兄弟姐妹,同科
cpu cores 条目包含位于相同物理封装中的内核数量。
如果处理器为英特尔处理器,则 vendor id 条目中的字符串是 GenuineIntel。

查看cpu运行模式

[root@cos7 ~ ]#lscpu
Architecture:          x86_64						#架构
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian				#小尾序
CPU(s):                2							#总共2核
On-line CPU(s) list:   0,1
Thread(s) per core:    1							#cpu中每个核core具有的线程,此处支持一个线程,即不支持超线程
Core(s) per socket:    1							#每个插槽上的具有的核数
Socket(s):             2							#总共有2插槽 (一个插槽可以安装一个cpu)
NUMA node(s):          1
Vendor ID:             GenuineIntel					#cpu产商 intel
CPU family:            6							#cpu系列
Model:                 142							#CPU属于其系列中的哪一代的代号
Model name:            Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Stepping:              10							#CPU属于制作更新版本
CPU MHz:               2001.000						#CPU的实际使用主频
CPU max MHz:           0.0000						#cpu主频
CPU min MHz:           0.0000
BogoMIPS:              4002.00
Hypervisor vendor:     VMware
Virtualization type:   full							#cpu支持的虚拟化技术
L1d cache:             32K							#一级缓存(数据缓存)
L1i cache:             32K							#一级缓存(指令缓存)
L2 cache:              256K							#二级缓存
L3 cache:              8192K						#三级缓存
NUMA node0 CPU(s):     0,1
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 epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp


[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo 
processor       : 0					#第几个逻辑cpu
vendor_id       : GenuineIntel		#CPU制造商
cpu family      : 6					#CPU产品系列代号
model           : 62				#CPU属于其系列中的哪一代的代号
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz	#CPU属于的名字及其编号、标称主频
stepping        : 4					#CPU属于制作更新版本
cpu MHz         : 2300.000			#CPU的实际使用主频
cache size      : 16384 KB			#CPU二级缓存大小
physical id     : 0					#单个CPU的标号
siblings        : 8					#单个CPU逻辑物理核数
core id         : 0				#当前物理核在其所处CPU中的编号,这个编号不一定连续
cpu cores       : 8				#该逻辑核所处CPU的物理核数
apicid          : 0			#用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
fpu             : yes		#是否具有浮点运算单元(Floating Point Unit)
fpu_exception   : yes		#是否支持浮点计算异常
cpuid level     : 13		#执行cpuid指令前,eax寄存器中的值,根据不同的值cpuid指令会返回不同的内容
wp              : yes		#表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
		#当前CPU支持的功能
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm

bogomips        : 4600.00	##在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)
clflush size    : 64	#每次刷新缓存的大小单位
cache_alignment : 64	#缓存地址对齐单位
address sizes   : 40 bits physical, 48 bits virtual	#可访问地址空间位数
power management: [8]	#对能源管理的支持,有以下几个可选支持功能:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 1
cpu cores       : 8
apicid          : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 2
cpu cores       : 8
apicid          : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 8
apicid          : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 4
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 4
cpu cores       : 8
apicid          : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 5
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 5
cpu cores       : 8
apicid          : 5
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 6
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 6
cpu cores       : 8
apicid          : 6
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 0
siblings        : 8
core id         : 7
cpu cores       : 8
apicid          : 7
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 8
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 0
cpu cores       : 8
apicid          : 8
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 9
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 1
cpu cores       : 8
apicid          : 9
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 10
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 2
cpu cores       : 8
apicid          : 10
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 11
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 3
cpu cores       : 8
apicid          : 11
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 12
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 4
cpu cores       : 8
apicid          : 12
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 13
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 5
cpu cores       : 8
apicid          : 13
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 14
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 6
cpu cores       : 8
apicid          : 14
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

processor       : 15
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      :       Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping        : 4
cpu MHz         : 2300.000
cache size      : 16384 KB
physical id     : 1
siblings        : 8
core id         : 7
cpu cores       : 8
apicid          : 15
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
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 ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: [8]

以上输出项的含义如下:
Cpu Info (参数大全及详解) 百度文库

processor :系统中逻辑处理核的编号。对于单核处理器,则默认为是其CPU编号,对于多核处理器则可以是物理核、或者使用超线程技术虚拟的逻辑核
vendor_id : CPU制造商
cpu family :CPU产品系列代号
model   :CPU属于其系列中的哪一代的代号
model name:CPU属于的名字及其编号、标称主频
stepping  :CPU属于制作更新版本
cpu MHz  :CPU的实际使用主频
cache size :CPU二级缓存大小
physical id :单个CPU的标号
siblings :单个CPU逻辑物理核数
core id :当前物理核在其所处CPU中的编号,这个编号不一定连续
cpu cores :该逻辑核所处CPU的物理核数
apicid :用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
fpu :是否具有浮点运算单元(Floating Point Unit)
fpu_exception :是否支持浮点计算异常
cpuid level :执行cpuid指令前,eax寄存器中的值,根据不同的值cpuid指令会返回不同的内容
wp :表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
flags :当前CPU支持的功能
bogomips :在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)
clflush size :每次刷新缓存的大小单位
cache_alignment :缓存地址对齐单位
address sizes :可访问地址空间位数

power management :对能源管理的支持,有以下几个可选支持功能:
  ts:  temperature sensor 温度传感器
  fid:  frequency id control 频率控制
  vid:  voltage id control 电压控制
  ttp:  thermal trip 热断路装置
  tm:
  stc:
  100mhzsteps:
  hwpstate:

CPU信息中flags各项含义:

fpu: Onboard (x87) Floating Point Unit
vme: Virtual Mode Extension
de: Debugging Extensions
pse: Page Size Extensions
tsc: Time Stamp Counter: support for RDTSC and WRTSC instructions
msr: Model-Specific Registers
pae: Physical Address Extensions: ability to access 64GB of memory; only 4GB can be accessed at a time though
mce: Machine Check Architecture
cx8: CMPXCHG8 instruction
apic: Onboard Advanced Programmable Interrupt Controller
sep: Sysenter/Sysexit Instructions; SYSENTER is used for jumps to kernel memory during system calls, and SYSEXIT is used for jumps: back to the user code
mtrr: Memory Type Range Registers
pge: Page Global Enable
mca: Machine Check Architecture
cmov: CMOV instruction
pat: Page Attribute Table
pse36: 36-bit Page Size Extensions: allows to map 4 MB pages into the first 64GB RAM, used with PSE.
pn: Processor Serial-Number; only available on Pentium 3
clflush: CLFLUSH instruction
dtes: Debug Trace Store
acpi: ACPI via MSR
mmx: MultiMedia Extension
fxsr: FXSAVE and FXSTOR instructions
sse: Streaming SIMD Extensions. Single instruction multiple data. Lets you do a bunch of the same operation on different pieces of input: in a single clock tick.
sse2: Streaming SIMD Extensions-2. More of the same.
selfsnoop: CPU self snoop
acc: Automatic Clock Control
IA64: IA-64 processor Itanium.
ht: HyperThreading. Introduces an imaginary second processor that doesn’t do much but lets you run threads in the same process a bit quicker.
nx: No Execute bit. Prevents arbitrary code running via buffer overflows.
pni: Prescott New Instructions aka. SSE3
vmx: Intel Vanderpool hardware virtualization technology
svm: AMD “Pacifica” hardware virtualization technology
lm: “Long Mode,” which means the chip supports the AMD64 instruction set
tm: “Thermal Monitor” Thermal throttling with IDLE instructions. Usually hardware controlled in response to CPU temperature.
tm2: “Thermal Monitor 2″ Decrease speed by reducing multipler and vcore.
est: “Enhanced SpeedStep”

根据以上内容,我们则可以很方便的知道当前系统关于CPU、CPU的核数、CPU是否启用超线程等信息。

查询系统具有多少个逻辑核:cat /proc/cpuinfo | grep “processor” | wc -l

查询系统CPU的物理核数:cat /proc/cpuinfo | grep “cpu cores” | uniq

查询系统CPU是否启用超线程:cat /proc/cpuinfo | grep -e “cpu cores” -e “siblings” | sort | uniq

输出举例:
    cpu cores : 6
    siblings  : 6

如果cpu cores数量和siblings数量一致,则没有启用超线程,否则超线程被启用。

查询系统CPU的个数:cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l

查询系统CPU是否支持某项功能,则根以上类似,输出结果进行sort, uniq和grep就可以得到结果

上面出处

Linux查看物理CPU个数、核数、逻辑CPU个数

CPU总核数 = 物理CPU个数 * 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 * 每颗物理CPU的核数 * 超线程数

#查看CPU信息(型号)
[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
     16        Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz

#查看物理CPU个数
[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
2

#查看每个物理CPU中core的个数(即核数)
[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores       : 8

查看逻辑CPU的个数
[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo| grep "processor"| wc -l
16

从上面执行的结果来看,证明我使用的cpu有2 * 8 = 16核,每个核有1个线程,所以有16个逻辑cpu。


查看CPU使用率的命令

top
使用权限:所有使用者
使用方式:top [-] [d delay] [q] [c] [S] [s] [i] [n] [b]
说明:即时显示process的动态

d :改变显示的更新速度,或是在交谈式指令列( interactive command)按s
q :没有任何延迟的显示速度,如果使用者是有superuser的权限,则top将会以最高的优先序执行
c :切换显示模式,共有两种模式,一是只显示执行档的名称,另一种是显示完整的路径与名称S :累积模式,会将己完成或消失的子行程( dead child process )的CPU time累积起来

s :安全模式,将交谈式指令取消,避免潜在的危机
i :不显示任何闲置(idle)或无用(zombie)的行程
n :更新的次数,完成后将会退出top
b :批次档模式,搭配"n"参数一起使用,可以用来将top的结果输出到档案内

41-2 Linux查看CPU和内存的配置信息_第4张图片可以看到CPU使用率百分比。Ctrl+C可以退出TOP。
也可以使用命令:cat /proc/stat查看。例如:

[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/stat
cpu  4686666890 26351572 175261846 162530979090 330619043 6597748 61050867 0
cpu0 186368861 2100440 21159578 10107378480 165942936 1303858 3770199 0
cpu1 209588486 2148370 12635035 10257818641 5603024 0 1005535 0
cpu2 205504490 1760338 8033938 10266784846 5601582 0 1070021 0
cpu3 209278145 1631015 7438158 10263855619 5489376 0 1054637 0
cpu4 203957823 1621475 8088986 10250831948 22986813 60482 1200306 0
cpu5 208515964 2030167 7079717 10264181293 5472074 73983 1406565 0
cpu6 209544576 1629061 7013841 10263608325 5448745 82244 1426199 0
cpu7 181177230 2628002 21732738 10248716001 13023863 2450517 19173303 0
cpu8 351272479 1347190 9474550 10089692589 34483153 278095 1952144 0
cpu9 375661518 1855966 13203191 10090266551 6364965 0 1168665 0
cpu10 375878058 1428914 7944996 10096010454 6068514 0 1165409 0
cpu11 375240290 1301076 7160833 10097676815 5975150 0 1146721 0
cpu12 376395472 1287021 6855515 10096806211 5996950 49 1152789 0
cpu13 374470558 1292201 8451697 10075105371 27658202 97945 1411004 0
cpu14 380165643 1294981 6767750 10093019719 5956209 19325 1261778 0
cpu15 463647289 995347 22221315 9969226218 8547481 2231245 21685585 0
intr 9295114323 2831075474 893 0 3 3 0 9 0 1 1 0 0 12752 0 0 317362508 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1280622292 0 0 0 0 0 0 0 34446869 0 0 0 0 0 0 0 3888277820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 471456356 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 471859342 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ctxt 427051841079
btime 1447224344
processes 391815428
procs_running 6
procs_blocked 0
查看CPU运行在多少位下的命令
[ams_zz @HXQ-CMS-APP01 :~]$ getconf LONG_BIT
64
#可以看到运行在64位下。
查看CPU是否支持64位运算
[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo | grep flags | grep ' lm '|wc -l
16
#等于16,说明16个逻辑CPU都支持64位运算, lm指long mode, 支持lm则是64bit。
#(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)
#使用uname查看
[ams_zz @HXQ-CMS-APP01 :~]$ uname -a
Linux HXQ-CMS-APP01 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux




查看当前操作系统发行版信息

https://blog.csdn.net/csdn_immortal/article/details/80751855
[root@HXQ-CMS-TEST ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
Kernel \r on an \m

查看机器型号(需要root权限)

[root@HXQ-CMS-TEST ~]# dmidecode | grep “Product Name”
Product Name: HVM domU

查看网卡信息

[cmszc_sh@HXQ-CMS-TEST ~]$ dmesg | grep -i eth
netfront: Initialising virtual ethernet driver.
eth0: no IPv6 routers present
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode
device eth0 entered promiscuous mode
device eth0 left promiscuous mode

查看内存信息

[cmszc_sh@HXQ-CMS-TEST ~]$ cat /proc/meminfo
MemTotal:     16412496 kB
MemFree:        953532 kB
Buffers:        325540 kB
Cached:        8515880 kB
SwapCached:      66912 kB
Active:       11527208 kB
Inactive:      3235476 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:     16412496 kB
LowFree:        953532 kB
SwapTotal:     8388600 kB
SwapFree:      7789088 kB
Dirty:             372 kB
Writeback:           0 kB
AnonPages:     5906148 kB
Mapped:        2379436 kB
Slab:           359944 kB
PageTables:     273532 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  16594848 kB
Committed_AS: 18484792 kB
VmallocTotal: 34359738367 kB
VmallocUsed:      5512 kB
VmallocChunk: 34359732815 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

[root@HXQ-CMS-TEST ~]# dmidecode -t memory

查看内存硬件信息

# dmidecode 2.11
SMBIOS 2.4 present.

Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
        Location: Other
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 16376 MB   #最大支持内存16G
        Error Information Handle: Not Provided
        Number Of Devices: 1

Handle 0x1100, DMI type 17, 21 bytes
Memory Device
        Array Handle: 0x1000
        Error Information Handle: 0x0000
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 16376 MB                   #实际内存16G
        Form Factor: DIMM
        Set: None
        Locator: DIMM 0
        Bank Locator: Not Specified
        Type: RAM
        Type Detail: None

查看网卡硬件信息

[root@cos7 ~ ]#lspci | grep -i 'eth'
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:06.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

如果要查看某个网络接口的详细信息,例如eth0的详细参数和指标
[root@HXQ-CMS-TEST ~]# ethtool eth0
Settings for eth0:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseT/Full
Supports auto-negotiation: No #支持自适应模式,一般都支持,此处不支持
Advertised link modes: 1000baseT/Full
Advertised auto-negotiation: No
Speed: 1000Mb/s #现在网卡的速度是1000Mb
Duplex: Full #全双工
Port: FIBRE
PHYAD: 0
Transceiver: external
Auto-negotiation: off
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes #表示有网线连接,和路由是通的

查看pci信息,即主板所有硬件槽信息。

[cmszc_sh@HXQ-CMS-TEST ~]$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:04.0 USB controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 10)
[cmszc_sh@HXQ-CMS-TEST ~]$ 

如果要更详细的信息:lspci -v 或者 lspci -vv

如果要看设备树:lscpi -t

[root@HXQ-CMS-TEST ~]# dmidecode -t bios

查看bios信息

[root@HXQ-CMS-TEST ~]# dmidecode -t bios
# dmidecode 2.11
SMBIOS 2.4 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: Xen
        Version: 4.1.2_115-901.200.
        Release Date: 11/03/2015
        Address: 0xE8000
        Runtime Size: 96 kB
        ROM Size: 64 kB
        Characteristics:
                PCI is supported
                EDD is supported
                Targeted content distribution is supported
        BIOS Revision: 4.1

dmidecode以一种可读的方式dump出机器的DMI(Desktop Management Interface)信息。这些信息包括了硬件以及BIOS,既可以得到当前的配置,也可以得到系统支持的最大配置,比如说支持的最大内存数等。

如果要查看所有有用信息

[root@HXQ-CMS-TEST ~]# dmidecode -q
BIOS Information
        Vendor: Xen
        Version: 4.1.2_115-901.200.
        Release Date: 11/03/2015
        Address: 0xE8000
        Runtime Size: 96 kB
        ROM Size: 64 kB
        Characteristics:
                PCI is supported
                EDD is supported
                Targeted content distribution is supported
        BIOS Revision: 4.1

System Information
        Manufacturer: Xen
        Product Name: HVM domU
        Version: 4.1.2_115-901.200.
        Serial Number: 35618325-7df1-4648-8919-8ade93978ef0
        UUID: 35618325-7DF1-4648-8919-8ADE93978EF0
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Not Specified

Chassis Information
        Manufacturer: Xen
        Type: Other
        Lock: Not Present
        Version: Not Specified
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Boot-up State: Safe
        Power Supply State: Safe
        Thermal State: Safe
        Security Status: Unknown

Processor Information
        Socket Designation: CPU 1
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 2
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 3
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 4
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 5
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 6
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 7
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

Processor Information
        Socket Designation: CPU 8
        Type: Central Processor
        Family: Other
        Manufacturer: Intel
        ID: E4 06 03 00 FF FB 8B 17
        Version: Intel(R) Xeon(R) CPU E5-4620 v2 @ 2.60GHz
        Voltage: Unknown
        External Clock: Unknown
        Max Speed: 2600 MHz
        Current Speed: 2600 MHz
        Status: Populated, Enabled
        Upgrade: Other

OEM Strings
        String 1: Xen

Physical Memory Array
        Location: Other
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 16376 MB
        Number Of Devices: 1

Memory Device
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 16376 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM 0
        Bank Locator: Not Specified
        Type: RAM
        Type Detail: None

Memory Array Mapped Address
        Starting Address: 0x00000000000
        Ending Address: 0x003FF7FFFFF
        Range Size: 16376 MB
        Partition Width: 1

Memory Device Mapped Address
        Starting Address: 0x00000000000
        Ending Address: 0x003FF7FFFFF
        Range Size: 16376 MB
        Partition Row Position: 1

System Boot Information
        Status: No errors detected

[root@HXQ-CMS-TEST ~]# 

里面包含了很多硬件信息。




你可能感兴趣的:(linux)