【命令星级】 ★★★☆☆
【功能说明】
dmidecode命令可以用来在Linux系统下获取硬件方面的信息。dmidecode遵循SMBIOS/DMI标准,其输出的信息包括BIOS、处理器、内存、缓存等。
【语法格式】
dmidecode [option]
dmidecode [选项]
**说明:**在dmidecode命令及后面的选项里,每个元素之间都至少要有一个空格。
【选项说明】
表11-12针对该命令的参数选项进行了说明。
表11-12 dmidecode命令的参数选项及说明

**范例11-40:**查看服务器型号。
[root@centos7 ~]# dmidecode -s system-product-name #查询为虚拟机平台。
VMware Virtual Platform
**范例11-41:**查看系统序列号。
[root@centos7 ~]# dmidecode -s system-product-number #查看序列号关键字system-product-number。
Invalid string keyword: system-product-number
Valid string keywords are:
bios-vendor
bios-version
bios-release-date
system-manufacturer
system-product-name
system-version
system-serial-number
system-uuid
system-family
baseboard-manufacturer
baseboard-product-name
baseboard-version
baseboard-serial-number
baseboard-asset-tag
chassis-manufacturer
chassis-type
chassis-version
chassis-serial-number
chassis-asset-tag
processor-family
processor-manufacturer
processor-version
processor-frequency
**范例11-42:**查看内存信息。
[root@centos7 ~]# dmidecode -t memory #使用-t选项接上关键字memory只查看内存的信息,更多关键字可通过dmidecode -t命令查看。
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0084, DMI type 5, 46 bytes
Memory Controller Information
Error Detecting Method: None
Error Correcting Capabilities:
None
Supported Interleave: One-way Interleave
Current Interleave: One-way Interleave
Maximum Memory Module Size: 32768 MB
Maximum Total Memory Size: 491520 MB
Supported Speeds:
70 ns
60 ns
Supported Memory Types:
FPM
EDO
DIMM
SDRAM
Memory Module Voltage: 3.3 V
Associated Memory Slots: 15
0x0006
0x0007
0x0008
0x0009
0x000A
0x000B
0x000C
0x000D
0x000E
0x000F
0x0010
0x0011
0x0012
0x0013
0x0014
Enabled Error Correcting Capabilities:
None
...
【命令星级】 ★★☆☆☆
【功能说明】
lspci命令用来显示系统中的所有PCI总线设备或是连接到该总线上的所有设备。
【语法格式】
lspci [option]
lspci [选项]
**说明:**在lspci命令及后面的选项里,每个元素之间都至少要有一个空格。
【选项说明】
表11-13针对该命令的参数选项进行了说明。
表11-13 lspci命令的参数选项及说明

**范例11-43:**显示所有PCI设备。
[root@centos7 ~]# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: Broadcom / LSI 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:00.0 USB controller: VMware USB1.1 UHCI Controller
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:02.0 Multimedia audio controller: Ensoniq ES1371/ES1373 / Creative Labs CT2518 (rev 02)
02:03.0 USB controller: VMware USB2 EHCI Controller
02:05.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
**范例11-44:**显示网卡设备信息。
[root@centos7 ~]# lspci -s 02:05.0 #02:05.0从范例1可知网卡设备的编号。
02:05.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
[root@centos7 ~]# lspci -s 02:05.0 -v #查看详细信息。
02:05.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
Subsystem: VMware PRO/1000 MT Single Port Adapter
Physical Slot: 37
Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 19
Memory at fd580000 (64-bit, non-prefetchable) [size=128K]
Memory at fdfe0000 (64-bit, non-prefetchable) [size=64K]
I/O ports at 2080 [size=64]
[virtual] Expansion ROM at fd510000 [disabled] [size=64K]
Capabilities: [dc] Power Management version 2
Capabilities: [e4] PCI-X non-bridge device
Kernel driver in use: e1000
Kernel modules: e1000