-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice_info.sh
executable file
·32 lines (24 loc) · 1.02 KB
/
device_info.sh
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
#!/bin/bash
sudo apt-get install -y smartmontools
read -p "Enter Your name: " name
output_file=device_info_${name// /_}.txt
printf "<${name}'s Computer>\n" > ${output_file}
printf "\n--------CPU Info--------\n\n" >> ${output_file}
lscpu | grep -E "Model name|Core\(s\) per socket|Socket\(s\)|每通訊端核心數:" >> ${output_file}
printf "\n--------GPU Info--------\n\n" >> ${output_file}
sudo lshw -c display | grep -E "product" >> ${output_file}
printf "\n--------RAM Info--------\n\n" >> ${output_file}
sudo dmidecode --type memory |\
grep -E "Memory Device|Size:|Type:|Speed:" |\
grep -v "Clock Speed:" |\
grep -v "Error" >> ${output_file}
printf "\n--------Disk Info--------\n\n" >> ${output_file}
disk_device_array=( $(ls /dev/sd* | grep -v "[0-9]") )
for (( i=0; i<${#disk_device_array[@]}; i++ ))
do
sudo smartctl -i ${disk_device_array[i]} |\
grep -E "Model Family:|User Capacity:|Rotation Rate:|SATA Version is:"\
>> ${output_file}
printf "\n"
done
printf "Finished. Please upload \"%s\"\n" ${output_file}