简单查看linux系统cpu\memory\disk

#!/bin/bash
# SCRIPT: hardware.sh work on Centos5
# AUTHOR: Gaizaoren
# DATE: 2012/08/08
# REV: 1.0 http://www.gaizaoren.org
# PURPOSE: This shell script use for find hareware
##########################################################
# BEGINNING OF MAIN
##########################################################
hard=$(dmidecode -t system |grep Manufa |awk '{print $2}')
hardware=$(dmidecode -t system |grep Product |awk '{print $3,$4}')
serial=$(dmidecode -t system |grep Serial |awk '{print $3}')

core=$(dmidecode -t processor |grep Version |grep -v "Not Specified"|awk '{print $2,$3,$4,$5,$6,$7}'|sed -n '1p')
core_count=$(dmidecode -t processor |grep Version |grep -v "Not Specified"|wc -l)

#raid=$( smartctl -a /dev/sda |grep "^Device" |awk '{print $3,$4}')
disk=$(fdisk -l |grep "^Disk"|awk -F"," '{print $1}')

Mem=$(dmidecode -t memory |grep "Size: [0-9]* MB"|sed -n '1p'|awk '{print $2,$3}'|awk '{print $1}')
Mem_count=$(dmidecode -t memory |grep "Size: [0-9]* MB"|wc -l)
Mem_total=`expr $Mem \* $Mem_count`
Mem_speed=$(dmidecode -t memory |grep Speed|grep MHz|awk '{print $2,$3}'|sed -n '1p')

echo "$hard $hardware $serial; $core X $core_count; ${Mem_total}MB $Mem_count X ${Mem}MB $Mem_speed; $disk"

##########################################################
# End of script
##########################################################

发表评论

电子邮件地址不会被公开。 必填项已用*标注