linux查看系统和cpu信息

来源:互联网 发布:c语言还是p语言好 编辑:程序博客网 时间:2024/05/16 06:25
.查看系统版本信息

lsb_release -a

或 cat /etc/redhat-release

.查看内核版本信息

uname -a

.查看机器运行位数

getconf LONG_BIT

.查看机器是否支持64位

cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l

(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)


附上检测shell脚本:

------------------------- sys-cpu-info.sh --------------------------
#!/bin/sh

descver=$(lsb_release -d)
ver=${descver#*"Description:"}

cat /etc/redhat-release

echo -ne "System version: \r\t\t\t"
echo -n $ver
echo -n "   "
#echo -ne "Runing bits: \r\t\t\t"
echo $(getconf LONG_BIT) "bits"

ret=$(cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l)

echo -ne "Cpu support 64-bit: \r\t\t\t"
if [ $ret -gt 0  ]
then
echo "yes"
else
echo "no"
fi

--------------------------------------------------------------------