仅自己使用的代码

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
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Detect CPU temperature (does not support multiple CPUs)
# cat /sys/class/thermal/thermal_zone0/temp
# Check the number of CPU cores Thread
# PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# grep 'processor' /proc/cpuinfo sort -u wc -l
echo "PATH Environment variable"
echo $PATH
echo -e "\n"
echo "CPU Infomation"
cpu_physics_cores=`grep 'physical id' /proc/cpuinfo sort uniq wc -l`
cpu_cores=`cat /proc/cpuinfo grep "processor" wc -l`
cpu_thread=`grep 'processor' /proc/cpuinfo sort -u wc -l`
# echo 'CPU cores $(cat /proc/cpuinfo grep "model name" wc -l)'
echo "CPU cores: ${cpu_cores}"
echo "CPU Threads: ${cpu_thread}"
echo "CPU Physics cpus: ${cpu_physics_cores}"
# Check CPU model
cat /proc/cpuinfo grep "model name" sort uniq
echo -e "\n"
echo "Memory Information"
# Check memory and swap space
cat /proc/meminfo grep -E "MemTotalMemFreeSwapTotalSwapFree"
echo -e "\n"
# Disk UUID information
echo "DISK UUID Information:"
ls -al /dev/disk/by-uuid sed -n '2,$p'
echo -e "\n"
# Disk Partitions infomation
echo "Disk Partitions information"
cat /proc/partitions
echo -e "\n"
# System information
echo "System version Information"
cat /etc/*-release
echo -e "\n"
echo "System Kernel Information"
cat /proc/version
echo -e "\n"
# Memory and Swap Details
echo "Memory and Swap Details"
free -h
echo -e "\n"
# Network Information
echo "Network Information"
ip addr
echo -e "\n"
echo "Route information"
route
echo -e "\n"
# Disk Mount Information
echo "Disk Mount Information"
df -Th
echo -e "\n"
# Hostname Information
echo "Hostname Information"
hostname
echo -e "\n"
# Datetime and Timezone Information
echo "Datetime and Timezone Information"
date "+%y-%m-%d %H:%M:%S %Z %z"