查看CPU信息
cpu_model=`cat /proc/cpuinfo |grep "model name"|awk -F ':' '{print $2}' |uniq` cpu_mhz=`cat /proc/cpuinfo |grep "cpu MHz"|awk -F ':' '{print $2}' |uniq` cpu_cache_size=`cat /proc/cpuinfo |grep "cache size"|awk -F ':' '{print $2}' |uniq` physical_cpu_count=`cat /proc/cpuinfo| grep "physical id"| sort -u | wc -l` logic_cpu_count=`cat /proc/cpuinfo| grep "processor"| wc -l` core_count_per_cpu=`cat /proc/cpuinfo| grep "cpu cores"|awk -F ':' '{print $2}' | uniq` support_64_count=`cat /proc/cpuinfo | grep flags | grep ' lm '|wc -l` sibling_count=`cat /proc/cpuinfo |grep "sibling" |awk -F ':' '{print $2}'|uniq` if [[ $support_64_count -gt 0 ]] then is_support_64=1 else is_support_64=0 fi if [[ $sibling_count -gt $core_count_per_cpu ]] then is_supper_thread=1 else is_supper_thread=0 fi echo "当前服务器CPU信息:" > /tmp/cpu_info.txt echo "物理CPU数量 : ${physical_cpu_count}" >> /tmp/cpu_info.txt echo "逻辑CPU数量 : ${logic_cpu_count}" >>/tmp/cpu_info.txt echo "每CPU物理Core数 : ${core_count_per_cpu}" >>/tmp/cpu_info.txt echo "是否超线程 : ${is_supper_thread}" >>/tmp/cpu_info.txt echo "是否支持64位 : ${is_support_64}" >>/tmp/cpu_info.txt echo "CPU型号 : ${cpu_model}" >>/tmp/cpu_info.txt echo "CPU频率 : ${cpu_mhz}" >>/tmp/cpu_info.txt echo "CPU缓存 : ${cpu_cache_size}" >>/tmp/cpu_info.txt cat /tmp/cpu_info.txt