CentOS 7.4 view CPU information (including script)

CentOS 7.4 view CPU information (including script)

2018 November 14, 10:51:27 DebugTheLife Reading number 1779

Copyright statement: © Original works from CSDN blog author Debug The Life. If you need to reprint, please indicate the source. https://blog.csdn.net/zhaoxixc/article/details/84062639

Physical id 	#Same as the same physical CPU
Processor 	#Logical CPU
Cpu cores 	#Number of CPU cores
Core id 	#Kernel id
Siblings 	#The number of logical CPUs in each physical CPU
[ root@testhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d:| uniq -c
  4 Intel(R)Core(TM) i7 CPU       M 620  @ 2.67GHz
[ root@testhost ~]# 
[ root@testhost ~]# cat /proc/cpuinfo | grep "physical id"| sort -u | wc -l  
2
[ root@testhost ~]# cat /proc/cpuinfo | grep "processor"| wc -l  
4
[ root@testhost ~]# cat /proc/cpuinfo | grep "cpu cores"| uniq  
cpu cores       :2
[ root@testhost ~]# cat /proc/cpuinfo | grep "siblings"| uniq  
siblings        :2

Logical CPU> Physical CPU x CPU cores#Turn on hyperthreading
Logical CPU = physical CPU x number of CPU cores# Hyper-threading is not enabled or hyper-threading is not supported

[ root@testhost ~]# cat /proc/cpuinfo | grep -e "cpu cores"-e "siblings"| sort | uniq
cpu cores       :2
siblings        :2

Note: If the number of cpu cores is the same as the number of siblings, hyperthreading is not enabled, otherwise hyperthreading is enabled.

[ root@testhost ~]# cat cpu.sh   
#! /bin/bash
cpuname=$(cat /proc/cpuinfo | grep name | cut -f2 -d:| uniq -c)
physical=$(cat /proc/cpuinfo | grep "physical id"| sort -u | wc -l)
processor=$(cat /proc/cpuinfo | grep "processor"| wc -l)
cpucores=$(cat /proc/cpuinfo  | grep "cpu cores"| uniq)
siblings=$(cat /proc/cpuinfo  | grep "siblings"| uniq)

echo "* * * * * CPU Information * * * * *"
echo "(CPU model) cpu name: $cpuname"
echo "(Number of physical CPUs) physical id is: $physical"
echo "(Number of logical CPUs) processor is: $processor"
echo "(CPU core number) cpu cores is: $cpucores"
echo "(Number of logical CPUs for a single physical CPU) siblings is: $siblings"[root@testhost ~]# 
[ root@testhost ~]# sh cpu.sh 
***** CPU Information *****
(CPU model) cpu name:4Intel(R)Core(TM) i7 CPU       M 620  @ 2.67GHz
(Number of physical CPUs) physical id is:2
(Number of logical CPUs) processor is:4
(CPU core number) cpu cores is: cpu cores   :2
(Number of logical CPUs for a single physical CPU) siblings is: siblings        :2[root@testhost ~]# 
  1. Check how many bits the system is
[ root@testhost ~]# uname -a
Linux testhost 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 2615:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description: i386 i686 is 32-bit; x86_64 is 64-bit

  1. Check whether the CPU is 32-bit or 64-bit
[ root@testhost ~]# cat /proc/cpuinfo | grep lm
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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat
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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat
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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat
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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat

Description: lm: "Long Mode," which means the chip supports the AMD64 instruction set

( adsbygoogle = window.adsbygoogle || []).push({});

Recommended Posts

CentOS 7.4 view CPU information (including script)
View CentOS version information
View CentOS version information
A centos initialization script
CentOS system optimization script, unfinished
CentOS 6 automatically installs RabbitMQ script
CentOS 6.X system initialization script