linux centos 查看cpu是否开启超线程虚拟化和配置信息

2020-10-09 10:30:53 浏览数 (1)

代码语言:javascript复制
#!/bin/bash
echo "开启虚拟化会有三行数据:"
lsmod |grep kvm                                                 # 虚拟化
cpuhx=`cat /proc/cpuinfo | grep "cores" | uniq | awk -F":" '{print $2}'`
echo "CPU 核心数:$cpuhx" ; 
cpuxc=`cat /proc/cpuinfo | grep "processor" | wc -l`
echo "CPU 线程数:$cpuxc
如果线程数是核心数的两倍,为开启了超线程" ;
cpuxh=`cat /proc/cpuinfo | grep "model name" | uniq | awk -F":" '{print $2}'`
echo "CPU 型号:$cpuxh" ; 
# 配置信息
echo "内存信息:"
parted -l | grep Disk | grep dev
free -hl | grep Mem | awk -F" " '{print $1,$2}'

rm -rf 1.sh ; history -c             # 删除脚本,并清除历史命令

0 人点赞