首页 > 技术文章 > 查看服务器CPU相关信息!

CMX_Shmily 2019-09-17 10:11 原文

 

 

# 查看物理CPU个数 
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l 
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 查看逻辑CPU的个数
c
 查看CPU信息(型号)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
# 查看cpu个数、频率、型号、厂商等详细信息
' cat /proc/cpuinfo '    ' lscpu '
# 获取cpu名称与主频
cat /proc/cpuinfo | grep 'model name'  | cut -f2 -d: | head -n1 | sed 's/^ //'
# 获取逻辑核数
cat /proc/cpuinfo | grep 'model name'  | wc -l
# 获取物理核数
cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l
# 查看cpu的flags
cat /proc/cpuinfo | grep flags | uniq | cut -f2 -d : | sed 's/^ //'
# 是否打开超线程(检查 physical id * cpu cores 与 processor的比例 1:1为未开启)
cat /proc/cpuinfo 
#查看CPU的线程数
grep "processor" /proc/cpuinfo | sort -u | wc -l

 

[root@localhost ~]# cat /proc/cpuinfo 
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model    : 78
model name    : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
stepping    : 3
microcode    : 0xc6
cpu MHz    : 2400.004
cache size    : 3072 KB
physical id    : 0
siblings    : 1
core id    : 0
cpu cores    : 1
apicid    : 0
initial apicid    : 0
fpu    : yes
fpu_exception    : yes
cpuid level    : 22
wp    : yes
flags    : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss 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 ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec arat spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips    : 4800.00
clflush size    : 64
cache_alignment    : 64
address sizes    : 43 bits physical, 48 bits virtual
power management:

 

推荐阅读