1、 查看物理CPU的个数
[root@centos7 data]# cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l
2
2、 查看CPU是几核
[root@centos7 data]# cat /proc/cpuinfo |grep "cores"|uniq
cpu cores : 2
3、 查看逻辑CPU的个数
[root@centos7 data]# cat /proc/cpuinfo |grep "processor"|wc -l
4
4、 查看CPU的主频
[root@centos7 data]# cat /proc/cpuinfo |grep "GHz"|uniq
model name : Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
5、 同时查看逻辑CPU和CPU核数
[root@centos7 data]# cat /proc/cpuinfo |grep name |cut -f2 -d:|uniq -c
4 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
6、 使用lscpu命令,可以一次查看所有信息
[root@centos7 data]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Model name: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Stepping: 9
CPU MHz: 4200.007
BogoMIPS: 8400.01
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc 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 fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities