myfreax

如何在 Ubuntu Linux 查看网卡的详细信息

如果你想在 Ubuntu 或者其他的 Linux 发行版,查找操作系统中使用的网卡(网络适配器),你可以使用 lshw 命令或者 lspci 命令,lshw 则比 lspci提供更多详细信息

4 min read
By myfreax
如何在 Ubuntu Linux 查看网卡的详细信息
如何在 Ubuntu Linux 查看网卡的详细信息

如果你想在 Ubuntu 或者其他的 Linux 发行版,查找操作系统中使用的网卡(网络适配器)。在 Linux ,很容易找到计算机中网络适配器的制造商。

你只需要在你的 Linux 发行版中安装 lshw 命令,lshw 命令是 List Hardware的缩写是 Linux 一个强大的命令行工具,用于提取计算机的硬件配置的详细信息。

它提供关于各种硬件组件的全面信息,包括CPU、内存、磁盘、网络接口等。下面是使用 lshw 查看网络适配器的方法。

lshw 命令查看网卡

使用快捷键 ctrl+alt+t 打开终端并运行命令 sudo lshw -C network ,该命令将会所有网卡的信息,其中包括制造商与型号:

sudo apt install lshw -y
sudo lshw -C network

如果 lshw 命令无法与 sudo 配合使用,请不要使用超级用户权限运行。这也许有点帮助。该命令的输出如下所示:

  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: enp4s0
       version: 1b
       serial: 88:ae:dd:59:60:9d
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.15.0-107-generic duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 ip=192.168.70.91 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:18 ioport:3000(size=256) memory:4f804000-4f804fff memory:4f800000-4f803fff

如你所见,我的计算机的网卡(网络适配器)是 Realtek RTL8111/8168/8411,这是一个瑞昱网卡,因商标的关系,部分电脑用户将其称为“螃蟹卡”。。

lshw 命令实际上可用于列出任何 Linux 的硬件信息,因此命令名为 lshw。这里使用 network 选项,它会过滤仅显示网络硬件的结果。

lspci 查看网卡

或者,您可以使用 lspci 命令来显示系统 PCI 总线的信息。您不需要 root 用户权限即可运行 lspci 命令。只需在终端中输入 lspci 命令即可:

lspci
00:00.0 Host bridge: Intel Corporation Device 4668 (rev 02)
00:01.0 PCI bridge: Intel Corporation Device 460d (rev 02)
00:02.0 Display controller: Intel Corporation Device 4680 (rev 0c)
00:08.0 System peripheral: Intel Corporation Device 464f (rev 02)
00:0a.0 Signal processing controller: Intel Corporation Device 467d (rev 01)
00:14.0 USB controller: Intel Corporation Device 7ae0 (rev 11)
00:14.2 RAM memory: Intel Corporation Device 7aa7 (rev 11)
00:15.0 Serial bus controller [0c80]: Intel Corporation Device 7acc (rev 11)
00:15.1 Serial bus controller [0c80]: Intel Corporation Device 7acd (rev 11)
00:15.3 Serial bus controller [0c80]: Intel Corporation Device 7acf (rev 11)
00:16.0 Communication controller: Intel Corporation Device 7ae8 (rev 11)
00:17.0 SATA controller: Intel Corporation Device 7ae2 (rev 11)
00:19.0 Serial bus controller [0c80]: Intel Corporation Device 7afc (rev 11)
00:19.1 Serial bus controller [0c80]: Intel Corporation Device 7afd (rev 11)
00:1a.0 PCI bridge: Intel Corporation Device 7ac8 (rev 11)
00:1c.0 PCI bridge: Intel Corporation Device 7ab9 (rev 11)
00:1c.2 PCI bridge: Intel Corporation Device 7aba (rev 11)
00:1e.0 Communication controller: Intel Corporation Device 7aa8 (rev 11)
00:1e.3 Serial bus controller [0c80]: Intel Corporation Device 7aab (rev 11)
00:1f.0 ISA bridge: Intel Corporation Device 7a86 (rev 11)
00:1f.3 Audio device: Intel Corporation Device 7ad0 (rev 11)
00:1f.4 SMBus: Intel Corporation Device 7aa3 (rev 11)
00:1f.5 Serial bus controller [0c80]: Intel Corporation Device 7aa4 (rev 11)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] (rev c7)
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X]
02:00.0 Non-Volatile memory controller: Phison Electronics Corporation E12 NVMe Controller (rev 01)
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 1b)

结论

要在 Ubuntu Linux 查看网卡的信息,你可以使用 lshw 或者 lspci 命令查看,lshw 是系统管理员和需要详细硬件信息的用户的一个重要工具,可用于故障排除、系统管理或系统优化。

它提供广泛的详细信息和支持多种输出格式,使其在不同的使用场景中具有高度的灵活性。

Related Articles