查看linux内存、cpu
1.查看cpu数
多核cpu,包括物理多核和逻辑多核,一台机器可能有多个cpu,每个cpu可能有多核的,多个可能包括物理多核和逻辑多核。
/proc/cpuinfo 文件里记录了这些信息,以下是一个核的信息:
processor : 3vendor_id : GenuineIntelcpu family : 6model : 13model name : QEMU Virtual CPU version (cpu64-rhel6)stepping : 3cpu MHz : 2299.998cache size : 4096 KBphysical id : 0siblings : 4core id : 1cpu cores : 2apicid : 3fpu : yesfpu_exception : yescpuid level : 4wp : yesflags : fpu de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm pni cx16 lahf_lmbogomips : 4599.31clflush size : 64cache_alignment : 64address sizes : 46 bits physical, 48 bits virtualpower management:
统计cpu数:grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l
统计总核:cat /proc/cpuinfo |grep 'processor'|wc -l
统计物理核:grep "cpu cores" /proc/cpuinfo
?2.查看内存
(1)cat /proc/meminfo
(2)free 参数 -g -m 等表示单位为G,M
(3)top
3.查看系统位数
getconf LONG_BIT