intel 发布的, 需具备有lspci 及ethtool 两个命令. 用户查看网卡信息非常方便
#! /bin/bash
#******************************************************************************
# Copyright(c) 1999 - 2008 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
# Contact Information:
# Linux NICS <linux.nics@intel.com>
# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
#******************************************************************************
#Determine how many Ethernet & Network controllers are installed in the system
TotalControllers=`lspci | grep -c -i 'Ethernet Controller\|Network Controller'`
temp=`lspci | grep -i 'Ethernet Controller\|Network Controller'|cut -f1 -d " "`
#Define two arrays for storing IPPorts
declare -a IOPorts1
declare -a IOPorts2
#Populate IOPorts1 with bus info from lspci. Populate IoPorts2 with bus info
#from ethtool.
for (( counter=0 ; counter < $TotalControllers ; counter++ ))
do
offset=$(($counter+1))
IOPorts1[$counter]=`echo $temp|cut -f$offset -d" "`
if (ethtool -i eth$counter) &> /dev/null; then
IOPorts2[$counter]=`ethtool -i eth$counter|grep 'bus-info'|cut -f3- -d :`
fi
done
#Loop through both arrays and determine if there's a match in IOPort1 & IOPort2. If so
#then the driver is loaded, and write to screen all the related information. If there
#is no match then there isn't a driver loaded for that device and write to screen only
#the information available from lspci
for ((counter=0 ; counter < $TotalControllers ; counter++))
do
Match=0
for ((counter1=0 ; counter1 < $TotalControllers; counter1++))
do
if [ "${IOPorts1[$counter]}" = "${IOPorts2[$counter1]}" ]; then
Match=1
DeviceID=`lspci -nn | grep ${IOPorts2[$counter1]} |cut -f3- -d"["| cut -c 1-9`
EthernetController=`lspci -v |grep ${IOPorts2[$counter1]} | cut -f4- -d" "|cut -f1 -d"("`
AdapterName=`lspci -v | grep ${IOPorts2[$counter1]} -A 1 | grep 'Subsystem'|cut -f2- -d" "`
DriverName=`ethtool -i eth$counter1 | grep -i 'driver' | cut -f2 -d" "`
DriverVersion=`ethtool -i eth$counter1 | grep -m 1 -i 'version'| cut -f2 -d" "`
echo "eth$counter1 : ${IOPorts2[$counter1]}"
echo " Make/Model = $AdapterName"
echo " Ethernet controller = $EthernetController"
echo " VenID:DevID = $DeviceID"
echo " Driver name = $DriverName"
echo " Driver version = $DriverVersion"
fi
done
if [ "$Match" = "0" ] ; then
DeviceID=`lspci -nn | grep ${IOPorts1[$counter]} |cut -f3- -d"["| cut -c 1-9`
EthernetController=`lspci -v |grep ${IOPorts1[$counter]} | cut -f4- -d" "|cut -f1 -d"("`
AdapterName=`lspci -v | grep ${IOPorts1[$counter]} -A 1 | grep 'Subsystem'|cut -f2- -d" "`
echo ": ${IOPorts1[$counter]}"
echo " Make/Model = $AdapterName"
echo " Ethernet controller = $EthernetController"
echo " VenID:DevID = $DeviceID"
echo " Driver name = No driver loaded"
echo " Driver version = No driver loaded"
fi
done
exit 0
分享到:
相关推荐
网络设备部分,HardINFO.sh应当能显示网卡型号、驱动程序信息以及当前的网络连接状态。这有助于诊断网络问题,比如识别是否需要更新驱动程序以提升网络性能。 除此之外,该工具可能还涉及其他硬件组件,如声卡、USB...
设备管理是Linux系统管理的一个重要组成部分,涉及设备的概念、管理的目标、设备的分类及命名。设备管理工作的内容包括设备的分配、控制、驱动和回收,设备驱动程序的功能和特点也非常重要。Linux系统下,与设备管理...
2. 驱动加载:在没有操作系统的情况下,可以手动加载硬件驱动,如网卡驱动,进行网络连接。 3. 系统调试:开发者使用EFI Shell进行底层硬件调试,测试固件更新和驱动程序。 4. 文件系统操作:EFI Shell可以读取和...
- **功能**:`lsscsi`命令用于列出SCSI/SATA设备信息,如硬盘驱动器、光盘驱动器等。 - **使用方法**:直接输入`lsscsi`命令。 - **示例**: ```shell $ lsscsi ``` ##### 6. lsusb - **功能**:`lsusb`命令可以...
2.4 Linux下的硬件设备管理 2.4.1 Linux设备管理概述 2.4.2 SCSI设备 2.4.3 硬盘 2.4.4 CD-ROM驱动器 2.4.5 调制解调器 第3章 配置TCP/IP网络 3.1 开始之前需要的信息 3.1.1 IP地址 3.1.2 网络掩码 3.1.3 网络...
此外,Linux的多用户、多任务环境和强大的shell脚本能力使其在系统管理和自动化方面具有优势。 在硬件支持方面,Linux能够很好地兼容各种硬件,包括PCI和USB设备。示例中的输出显示了Intel 82801G(ICH7家族)提供...
- **阅读书籍:**经典书籍如《鸟哥的Linux私房菜》、《Linux命令行与shell脚本编程大全》等,提供了深度解析和实战案例。 通过系统的学习和不断的实践,新手可以逐渐成长为熟练的Linux用户,甚至开发人员。记住,...
Shell脚本是Linux和Unix系统中的强大工具,允许用户编写自定义命令序列以执行复杂操作,而无需深入了解底层系统的每个细节。 1. **键盘背光控制**:在Arch Linux上,Dell XPS 13的键盘背光可能无法直接通过默认设置...
首先,你需要准备一个无线网卡,由于Intel 3945的网卡默认驱动不支持破解,因此需要安装支持破解的驱动`ipwrawupdate.lzm`。为了方便,建议将U盘格式化为FAT32格式,然后下载BT3的USB启动版ISO镜像文件(约783MB),...
NVIDIA和Intel的图形驱动,以及Realtek或Intel的无线网卡驱动可能是常见需求。 11. **日常维护**: 学习定期更新系统(`pacman -Syu`),备份重要数据,以及使用`logrotate`管理日志文件等基本维护操作。 以上...