1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
[root@localhost ~]# vi showhardwareinfo.sh
#!/bin/bash
yum install hdparm dmidecode pciutils -y
echo
echo
"###### CPU #######"
echo
cat /proc/cpuinfo | grep
"model name"
| awk -F
":"
'{print $2}'
| uniq -f
1
cat /proc/cpuinfo | grep
"cpu cores"
| awk -F
":"
'{print " CPU ="$2}'
| uniq -f
1
echo
echo
"###### Hard Disk ######"
echo
hdparm -i /dev/sda | grep -i
"model"
| awk -F
"-"
'{print $1}'
| awk -F
"="
'{print $2}'
fdisk -l | grep
"/dev/sda"
| awk -F
","
'NR==1{print $1}'
echo
df -h
echo
echo
"###### Memory ######"
echo
dmidecode -t memory | grep -i
"maximum capacity"
dmidecode -t memory | grep -i
"number of devices"
echo
dmidecode -t memory | grep -i
"size"
| awk -F
":"
'NR==1{print " Capacity 1" $1":",$2}'
dmidecode -t memory | grep -i
"speed"
| awk
'NR==1'
dmidecode -t memory | grep -i
"type:"
| uniq -f
1
dmidecode -t memory | grep -i
"size"
| awk -F
":"
'NR==2{print " Capacity 2" $1":",$2}'
dmidecode -t memory | grep -i
"speed"
| awk
'NR==2'
dmidecode -t memory | grep -i
"type:"
| uniq -f
1
dmidecode -t memory | grep -i
"size"
| awk -F
":"
'NR==3{print " Capacity 3" $1":",$2}'
dmidecode -t memory | grep -i
"speed"
| awk
'NR==3'
dmidecode -t memory | grep -i
"type:"
| uniq -f
1
dmidecode -t memory | grep -i
"size"
| awk -F
":"
'NR==4{print " Capacity 4" $1":",$2}'
dmidecode -t memory | grep -i
"speed"
| awk
'NR==4'
dmidecode -t memory | grep -i
"type:"
| uniq -f
1
echo
free -m
echo
echo
"###### Mianboard ######"
echo
dmidecode -q | grep -i
"product name"
| awk -F
":"
'NR==1{print "Server Model" ":",$2}'
dmidecode -q | grep -i
"Manufacturer"
| awk -F
":"
'NR==1{print "Brand" ":",$2}'
dmidecode -q | grep -i
"product name"
| awk -F
":"
'NR==2{print "Mainboard Model" ":",$2}'
echo
echo
"###### Network Card ######"
echo
lspci | grep -i eth | awk
'NR==1'
| awk -F
":"
'{print $3}'
echo
echo
"###### Operating System ######"
echo
cat /etc/issue | awk
'NR==1'
uname -r | awk
'{print "kernel: "$1}'
echo
|
1
2
|
[root@localhost ~]
# chmod +x showhardwareinfo.sh
[root@localhost ~]
# ./showhardwareinfo.sh
|