使用lscpu命令
[root@Docker ~]# 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: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
Stepping: 4
CPU MHz: 2499.980
BogoMIPS: 4999.96
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 33792K
NUMA node0 CPU(s): 0-3
直接查看文件
[root@vultr ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Virtual CPU 82d9ed4018dd
stepping : 4
microcode : 0x1
cpu MHz : 2600.000
cache size : 16384 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
bogomips : 5200.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
查看物理CPU的个数
[root@vultr ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
1
查看逻辑CPU的个数
[root@vultr ~]# cat /proc/cpuinfo | grep "processor" | wc -l
1
查看CPU是几核
[root@vultr ~]# cat /proc/cpuinfo | grep "cores" | uniq
cpu cores : 1
查看CPU主频
[root@vultr ~]# cat /proc/cpuinfo | grep MHz | uniq
cpu MHz : 2600.000