Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

21.5. 查看硬件信息

21.5.1. 使用 lspci 命令

lspci 命令允许您显示有关 PCI 总线及其关联的设备的信息。要列出系统中的所有 PCI 设备,在 shell 提示符后输入以下内容:

lspci

这会显示一个简单的设备列表,例如:

~]$ lspci
00:00.0 Host bridge: Intel Corporation 82X38/X48 Express DRAM Controller
00:01.0 PCI bridge: Intel Corporation 82X38/X48 Express Host-Primary PCI Express Bridge
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02)
00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02)
[output truncated]

您还可以使用 -v 命令行选项显示更详细的输出,或使用 -vv 来获得非常详细的输出:

lspci -v|-vv

例如,要确定系统的显卡厂商、型号和内存大小,请输入:

~]$ lspci -v
[output truncated]

01:00.0 VGA compatible controller: nVidia Corporation G84 [Quadro FX 370] (rev a1) (prog-if 00 [VGA controller])
    Subsystem: nVidia Corporation Device 0491
    Physical Slot: 2
    Flags: bus master, fast devsel, latency 0, IRQ 16
    Memory at f2000000 (32-bit, non-prefetchable) [size=16M]
    Memory at e0000000 (64-bit, prefetchable) [size=256M]
    Memory at f0000000 (64-bit, non-prefetchable) [size=32M]
    I/O ports at 1100 [size=128]
    Expansion ROM at <unassigned> [disabled]
    Capabilities: <access denied>
    Kernel driver in use: nouveau
    Kernel modules: nouveau, nvidiafb

[output truncated]

有关可用命令行选项的完整列表,请查看 lspci(8)手册页。

21.5.2. 使用 lsusb 命令

lsusb 命令允许您显示有关 USB 总线和连接到它们的设备的相关信息。要列出系统中的所有 USB 设备,在 shell 提示符后输入以下内容:

lsusb

这会显示一个简单的设备列表,例如:

~]$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[output truncated]
Bus 001 Device 002: ID 0bda:0151 Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)
Bus 008 Device 002: ID 03f0:2c24 Hewlett-Packard Logitech M-UAL-96 Mouse
Bus 008 Device 003: ID 04b3:3025 IBM Corp.

您还可以使用 -v 命令行选项来显示更详细的输出:

lsusb -v

例如:

~]$ lsusb -v
[output truncated]

Bus 008 Device 002: ID 03f0:2c24 Hewlett-Packard Logitech M-UAL-96 Mouse
Device Descriptor:
 bLength        18
 bDescriptorType     1
 bcdUSB        2.00
 bDeviceClass      0 (Defined at Interface level)
 bDeviceSubClass     0
 bDeviceProtocol     0
 bMaxPacketSize0     8
 idVendor      0x03f0 Hewlett-Packard
 idProduct     0x2c24 Logitech M-UAL-96 Mouse
 bcdDevice      31.00
 iManufacturer      1
 iProduct        2
 iSerial         0
 bNumConfigurations   1
 Configuration Descriptor:
  bLength         9
  bDescriptorType     2
[output truncated]

有关可用命令行选项的完整列表,请查看 lsusb(8)手册页。

21.5.3. 使用 lscpu 命令

lscpu 命令允许您列出系统中存在的 CPU 的信息,包括 CPU 的数量、其架构、供应商、系列、型号、CPU 缓存等。要做到这一点,在 shell 提示符后输入以下内容:

lscpu

例如:

~]$ lscpu
Architecture:     x86_64
CPU op-mode(s):    32-bit, 64-bit
Byte Order:      Little Endian
CPU(s):        4
On-line CPU(s) list:  0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):       1
NUMA node(s):     1
Vendor ID:       GenuineIntel
CPU family:      6
Model:         23
Stepping:       7
CPU MHz:        1998.000
BogoMIPS:       4999.98
Virtualization:    VT-x
L1d cache:       32K
L1i cache:       32K
L2 cache:       3072K
NUMA node0 CPU(s):   0-3

有关可用命令行选项的完整列表,请查看 lscpu(1)手册页。