linux系统中查看逻辑cpu个数、物理cpu个数、每个cpu的核心数、cpu型号

 

1、逻辑cpu个数(线程数)

[root@centos79 test]# cat /proc/cpuinfo | grep "processor"
processor       : 0
processor       : 1
processor       : 2
processor       : 3
[root@centos79 test]# cat /proc/cpuinfo | grep "processor" | wc -l
4

 

2、物理cpu个数

[root@centos79 test]# cat /proc/cpuinfo | grep "physical id"
physical id     : 0
physical id     : 0
physical id     : 1
physical id     : 1
[root@centos79 test]# cat /proc/cpuinfo | grep "physical id" | sort | uniq -c
      2 physical id     : 0
      2 physical id     : 1
[root@centos79 test]# cat /proc/cpuinfo | grep "physical id" | sort | uniq -c | wc -l
2

 

3、查看每个cpu核心数

[root@centos79 test]# cat /proc/cpuinfo | grep "cpu cores"
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
[root@centos79 test]# cat /proc/cpuinfo | grep "cpu cores" | uniq | awk -F: {print $2}
 2

 

4、查看cpu型号

[root@centos79 test]# dmidecode -s processor-version | uniq
AMD Ryzen 5 3600X 6-Core Processor

 

 

5、汇总

[root@centos79 test]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4     ## 逻辑cpu个数
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    2     ## 每个cpu核心数
Socket(s):             2     ## 物理cpu个数
NUMA node(s):          1
Vendor ID:             AuthenticAMD
CPU family:            23
Model:                 113
Model name:            AMD Ryzen 5 3600X 6-Core Processor   ## cpu型号
Stepping:              0
CPU MHz:               3800.009
BogoMIPS:              7600.01
Virtualization:        AMD-V
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              512K
L3 cache:              32768K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl tsc_reliable nonstop_tsc extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core retpoline_amd ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec clzero arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists overflow_recov succor

 

linux系统中查看逻辑cpu个数、物理cpu个数、每个cpu的核心数、cpu型号

上一篇:Photoshop 轻松绘制黑色风格导航条文字


下一篇:有遍历目录所有文件中关键字命令行脚本引发的思考