Linux查看CPU和内存的配置信息
CPU配置信息:
frank@ubuntu:~/test/python$ cat /proc/cpuinfo processor : 0 #系统中逻辑处理核的编号 vendor_id : GenuineIntel #CPU制造商 cpu family : 6 #CPU产品系列代号 model : 79 #CPU属于其系列中的哪一代的代号 model name : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz #CPU属于的名字及其编号、标称主频 stepping : 1 #CPU属于制作更新版本 microcode : 0xb00001f cpu MHz : 2199.900 #CPU的实际使用主频 cache size : 25600 KB #CPU二级缓存大小 physical id : 0 #单个CPU的标号 siblings : 20 #一个物理CPU中的逻辑核数 core id : 0 #当前物理核在其所处CPU中的编号,这个编号不一定连续 cpu cores : 10 #一个物理CPU中的物理核数 apicid : 0 #用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 20 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap bogomips : 4399.80 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management: 物理CPU个数: cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l 每个CPU物理核数: cat /proc/cpuinfo |grep "cpu cores"|uniq 每个CPU逻辑核数: cat /proc/cpuinfo |grep "siblings"|uniq 总CPU逻辑核数: cat /proc/cpuinfo |grep -c "processor" 我的服务器是两个芯片组,每个芯片组是10核,支持超线程,所以逻辑CPU是40。 超线程指物理内核+逻辑内核,芯片上只存在一个物理内核,但是这个物理内核可以模拟出一个逻辑内核,于是系统信息就显示了两个内核,一真一假。
1.查看内存槽数、哪个槽位插了内存,大小是多少 frank@ubuntu:~/test$ sudo dmidecode|grep -P -A5 "Memory Device" |grep Size Size: 32 GB Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: 32 GB Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed Size: No Module Installed 2.查看最大支持内存数 frank@ubuntu:~/test$ sudo dmidecode -t memory |grep "Maximum Capacity" Maximum Capacity: 3 TB 3.查看内存速率 frank@ubuntu:~/test$ sudo dmidecode|grep -A16 "Memory Device"|grep 'Speed' Speed: 2400 MHz Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: 2400 MHz Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown Speed: Unknown
1 #!/bin/sh 2 3 echo ">>>need root permission<<<\n" 4 5 echo "1. equipment brand: `dmidecode -s system-product-name`" 6 7 echo "2. OS info: `lsb_release -d | grep "Description"|awk -F: '{print $2}'`" 8 9 echo "3. kernel info: `uname -s -m -r`" 10 11 echo "4. hardware platform: `uname -i`" 12 13 echo "5. cpu info:" 14 echo "\tbrand and freq: `cat /proc/cpuinfo |grep "model name"|uniq |awk -F: '{print $2}'`" 15 echo "\tphysical CPUs:`cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l`" 16 echo "\tphysical cores per CPU: `cat /proc/cpuinfo |grep "cpu cores"|uniq|awk -F: '{print $2}'`" 17 echo "\tlogical cores per CPU: `cat /proc/cpuinfo |grep "siblings"|uniq|awk -F: '{print $2}'`" 18 echo "\ttotal logic cores: `cat /proc/cpuinfo |grep -c "processor"`" 19 20 echo "6. memory slots and size: \n `dmidecode|grep -P -A5 "Memory Device" |grep Size`" 21 22 echo "7. maximum capacity of memory: `dmidecode -t memory |grep "Maximum Capacity"| awk -F: '{print $2}'`" 23 echo "8. memory speed: \n`dmidecode|grep -A16 "Memory Device"|grep 'Speed'`"