SHELL自动获取硬件信息
Posted 小徐xfg
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SHELL自动获取硬件信息相关的知识,希望对你有一定的参考价值。
#!bin/bash
echo -e "------ os release ------"
cat /etc/redhat-release
cat /etc/issue | grep Linux
echo -e "\\n ------ cpu physical ------"
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
echo -e "------ cpu info ------"
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
echo -e "------ cpu processor ------"
cat /proc/cpuinfo | grep "processor" | uniq | wc -l
echo -e "\\n ------ os BIT ------"
getconf LONG_BIT
uname -m
echo -e "------ os type ------"
dmidecode |grep "Product"
echo -e "\\n ------ os network ------"
ls /sys/class/net/
echo -e "------ virtual network ------"
ls /sys/devices/virtual/net/
echo -e "------ devices network ------"
ls /sys/class/net/ | grep -v "`ls /sys/devices/virtual/net/`"
echo -e "\\n ------ os free ------"
free -h
echo -e "------ os disk ------"
df -h
echo -e "------ fdisk ------"
df -h|grep "/dev/"
fdisk -l|grep "/dev/"
echo -e "\\n ------ L1d cache ------ "
lscpu | grep -i 'L1d 缓存\\|L1d cache' | awk -F ':|:' 'print $2'
echo -e "------ L1i cache ------"
lscpu | grep -i 'L1i 缓存\\|L1i cache' | awk -F ':|:' 'print $2'
echo -e "------ L2 cache ------"
lscpu | grep -i 'L2 缓存\\|L2 cache' | awk -F ':|:' 'print $2'
echo -e "------ L3 cahce ------"
lscpu | grep -i 'L3 缓存\\|L3 cache' | awk -F ':|:' 'print $2'
以上是关于SHELL自动获取硬件信息的主要内容,如果未能解决你的问题,请参考以下文章