Chinaunix首页 | 论坛 | 博客
  • 博客访问: 344012
  • 博文数量: 222
  • 博客积分: 9349
  • 博客等级: 中将
  • 技术积分: 2135
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 13:45
文章分类

全部博文(222)

文章存档

2010年(222)

分类: LINUX

2010-08-08 10:36:51

#!/bin/bash
# LiveUSB.sh - Check your new notebook's hardware..
#
# Copyright (C) Thu Jan 28,2010  
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# [========== GNU Lesser General Public License ==========]
# "Free software" is a matter of liberty,not price.To understand the
# concept,you should think of "free speech",not "free beer".
# "Free software" refers to the user's freedom to run,copy,distribute,
# study,change,and improve the software.
#

#####################
# Env Configuration #
#####################
#sed -i "6a alias grep='grep --color=auto'" ~/.bashrc
#source ~/.bashrc
clear 

############
# CPU INFO #
############
echo -e "[+] Checking CPU...\n"
PROCESSORNUM=$(cat /proc/cpuinfo |grep processor |wc -l)
CPUINFO=$(cat /proc/cpuinfo |grep -A6 --color=auto 'vendor_id'|sed -n '1,7p')
Arch=$(uname -m)
printf "Your have $PROCESSORNUM CPU, and the Machine Hardware Name is:$Arch..\n"
printf "Here's the whole CPU Info follow..\n"
printf "$CPUINFO\n"
printf "\n"

#########################
# RAM INFO And DISK INFO#
#########################
echo -e "[+] Checking RAM and DISK...\n"
# Get Cache and Buffer's Speed
#hdparm -Tt /dev/sda > ramdisk.info

RAMSIZE=$(free -m |grep Mem |awk '{print $2}')
RAMCACHE=$(cat ramdisk.info |grep 'cached' |cut -d: -f2 |cut -d'=' -f2)
DISKSIZE=$( fdisk -l /dev/sda |grep '/dev/sda:'|cut -d: -f2|cut -d',' -f1)
DISKBUFFER=$(cat ramdisk.info |grep 'buffered' |cut -d: -f2 |cut -d'=' -f2)
printf "The RAM Size is: $RAMSIZE MB,\n"
#printf "and RAM's Cache Speed is: $RAMCACHE..\n"

printf "The DISK Size is: $DISKSIZE GB,\n"
#printf "and DISK's Buffer Speed is: $DISKBUFFER..\n"
printf "Here's the RAM's Cache Speed and DISK's Buffer Speed follow:"
hdparm -Tt /dev/sda
printf "\n"

############
# PCI INFO #
############
echo -e "[+] Printing PCI INFO..\n"
read -p "Continue(Y/y),Quit(N/n).." YN
if [ "$YN" == "Y" ] || [ "$YN" == "y" ]; then
echo -e "PCI INFO Follow:\n"
elif [ "$YN" == "N" ] || [ "$YN" == "n" ]; then
exit 0
else
echo "Please Input Keyword 'Y/y' to Continue..\n"
fi
printf "\n"

#############
# BIOS INFO #
#############
echo -e "[+] Printing BIOS INFO..\n"
BIOS=$(dmidecode |sed -n '7,40p')
printf "$BIOS\n"
printf "\n"

##############################
# SYSTEM and Base Board INFO #
##############################
echo -e "[+] Printing SYSTEM  and Base Board INFO..\n"
SYSTEM=$(dmidecode |sed -n '43,66p'|less)
printf "$SYSTEM\n"

printf "\n"
##################
# Processor INFO #
##################
echo -e "[+] Printing Processor INFO..\n"
Processor=$(dmidecode |sed -n '86,105p'|less)
printf "$Processor\n"

printf "\n"
##################
# CPU Cache INFO #
##################
echo -e "[+] Printing L1-Cache INFO..\n"
L1=$(dmidecode |sed -n '108,121p'|less)
printf "$L1\n"

printf "\n"
echo -e "[+] Printing L2-Cache INFO..\n"
L2=$(dmidecode |sed -n '124,137p'|less)
printf "$L2\n"

printf "\n"
echo -e "[+] Printing L3-Cache INFO..\n"
L3=$(dmidecode |sed -n '140,153p'|less)
printf "$L3\n"

printf "\n"
###############
# Memory INFO #
###############

echo -e "[+] Printing Memory INFO..\n"
Memory=$(dmidecode |sed -n '156,174p')
printf "$Memory\n"
printf "\n"

echo -e "[+] Printing PhysicalMem INFO..\n"
PhysiMem=$(dmidecode |sed -n '389,461p')
printf "$PhysiMem\n"
printf "\n"

#################
# On Board INFO #
#################

echo -e "[+] Printing Memory INFO..\n"
ONBOARD=$(dmidecode |sed -n '356,373p')
printf "$ONBOARD\n"
printf "\n"
阅读(353) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~