linux查看cpu型号命令的方法(linux如何查看cpu命令)

cat /proc/cpuinfo

常用命令如下:

# 查看cpu详细信息cat /proc/cpuinfo# 查看CPU信息(型号)cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c# 查看物理CPU个数cat /proc/cpuinfo| grep “physical id”| sort| uniq| wc -l# 查看每个物理CPU中core的个数(即核数)cat /proc/cpuinfo| grep “cpu cores”| uniq# 查看逻辑CPU的个数cat /proc/cpuinfo| grep “processor”| wc -l
linux查看cpu型号命令的方法(linux如何查看cpu命令)

下面是我阿里云的服务器信息,2核4G的ECS。

[root@iZ2zebthf35ejlps5v87ksZ ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 2 Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz[root@iZ2zebthf35ejlps5v87ksZ ~]# cat /proc/cpuinfo| grep “physical id”| sort| uniq| wc -l1[root@iZ2zebthf35ejlps5v87ksZ ~]# cat /proc/cpuinfo| grep “cpu cores”| uniqcpu cores : 1[root@iZ2zebthf35ejlps5v87ksZ ~]# cat /proc/cpuinfo| grep “processor”| wc -l2

从上面的结果可以看到,我的机器拥有两个逻辑cpu,型号是Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz,但是从结果“physical”来看,只有一个物理核心。

扩展:uniq命令是去重,wc是统计。

lscpu

此外,还有个lscpu命令,可以提供有效、精简的cpu信息。

实例如下:

[root@yaomm ~]# lscpuArchitecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianCPU(s): 2 On-line CPU(s) list: 0,1Thread(s) per core: 2Core(s) per socket: 1Socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 79Model name: Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHzStepping: 1CPU MHz: 2500.030BogoMIPS: 5000.06Hypervisor vendor: KVMVirtualization type: fullL1d cache: 32KL1i cache: 32KL2 cache: 256KL3 cache: 40960KNUMA node0 CPU(s): 0,1Flags: 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 rep_good nopl 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 ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt spec_ctrl intel_stibp

部分参数释义如下

Architecture: x86_64#<=== x86架构

CPU(s): 2#<=== 双核cpu

Thread(s) per core: 2#<=== 每核超线程

Core(s) per socket: 1#<=== 每核线程数

Socket(s): 1#<=== 主板插槽,物理cpu数

Model name: Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz#<=== cpu型号

L1d cache及其他cache #<=== cpu缓存相关

发表评论

登录后才能评论