查看系统信息(脚本)
#!/bin/bash #linux.info.sh #系统信息查看 [ -f /usr/sbin/dmidecode ] && { dmidecode | grep 'Product Name' |uniq; } echo if [ -f /etc/redhat-release ];then cat /etc/redhat-release elif [ -f /etc/lsb-release ];then awk -F '"' '/DISTRIB_DESCRIPTION/{print $2}' /etc/lsb-release else awk -F'"' '/PRETTY_NAME/{print $2}' /etc/os-release fi echo "kernel `uname -r`" echo echo "CPU" cat /proc/cpuinfo |grep "name" |cut -f2 -d: |uniq echo "cpu物理个数 `cat /proc/cpuinfo | grep "physical id"| sort| uniq| wc -l`" echo "cpu逻辑个数 `cat /proc/cpuinfo| grep "processor"| wc -l`" echo #echo "内存 `free -g |awk '/Mem/{print $2" G"}'`" echo "内存 `free -m |awk '/Mem/{printf ("%.2f\n", $2/1024)}'`GB" #内存数量、频率 if [ -e /usr/sbin/dmidecode ];then dmidecode -t memory |awk '/Size.*MB/{print "条 "$2/1024 "GB"}' |uniq -dc dmidecode|grep -A16 "Memory Device"|awk '/Speed.*MHz/{print "频率 "$2 $3}' |uniq -dc dmidecode -t memory |awk '/DDR/{print "接口 "$2}' |uniq -dc echo "插槽数量 `dmidecode -t memory |grep Size |wc -l`" fi echo echo "Disk" lsblk |awk '/disk/{print $1" "$4}' df -hlT |egrep '^/dev/|^Filesystem|/$' |egrep -v '^/dev/loop' echo