其他分享
首页 > 其他分享> > bash脚本检查系统CPU型号数量

bash脚本检查系统CPU型号数量

作者:互联网

直接上代码 保存下来就可以运行了

#!/bin/bash
physical_name=`cat /proc/cpuinfo | grep 'model name' |uniq|awk -F : '{print $NF}'`
physical=`cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l`
cpu=`cat /proc/cpuinfo |grep "cores"|uniq|awk '{print $NF}'`
thread=`grep 'processor' /proc/cpuinfo | sort -u | wc -l`
let tmp=thread/physical
let per_cpu_thread=tmp/cpu

echo "CPU型号为:$physical_name"
echo "CPU数量为:$physical"
echo "每个CPU包含的逻辑CPU数量为:$cpu"
echo "每个逻辑CPU线程数为:$per_cpu_thread"
echo "总共线程数量为:$thread"

 

标签:cpuinfo,thread,CPU,echo,型号,cpu,bash,physical
来源: https://www.cnblogs.com/yuandaozhe/p/15767448.html