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"

 

上一篇:Centso8虚拟机 搭建yum


下一篇:Docker 安装&卸载