Linux 列出硬件信息命令
您可以使用以下任意一种工具来提取机器硬件配置的详细信息:
- dmidecode命令 – 查看系统硬件组件的描述,以及其他有用的信息,如序列号和 BIOS 修订版。
- lshw命令 — 列出硬件命令。
- ls*命令。
- /proc/文件系统
教程详细信息 | |
---|---|
难度等级 | 中间的 |
Root 权限 | 是的 |
要求 | lshw/dmidecode |
预计阅读时间 | 6 分钟 |
方法 #1 dmidecode 工具
使用 yum 或 apt-get 命令安装 dmidecode 工具。安装后,输入以下命令列出硬件信息:
# dmidecode
示例输出:
SMBIOS 2.6 present. 18 structures occupying 992 bytes. Table at 0x0009B400. Handle 0x0000, DMI type 0, 24 bytes BIOS Information Vendor: American Megatrends Inc. Version: 080016 Release Date: 04/01/2010 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 1024 kB Characteristics: ISA is supported PCI is supported PNP is supported BIOS is upgradeable BIOS shadowing is allowed ESCD support is available Boot from CD is supported Selectable boot is supported BIOS ROM is socketed EDD is supported 5.25"/1.2 MB floppy services are supported (int 13h) 3.5"/720 kB floppy services are supported (int 13h) 3.5"/2.88 MB floppy services are supported (int 13h) Print screen service is supported (int 5h) 8042 keyboard services are supported (int 9h) Serial services are supported (int 14h) Printer services are supported (int 17h) CGA/mono video services are supported (int 10h) ACPI is supported USB legacy is supported LS-120 boot is supported ATAPI Zip drive boot is supported BIOS boot specification is supported Targeted content distribution is supported BIOS Revision: 8.16 Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: ICP / iEi Product Name: TS-859 PRO Version: V1.0 Serial Number: To Be Filled By O.E.M.
请参阅我们的文章“无需打开机箱即可从外壳获取有关 BIOS/服务器硬件的信息”以了解更多信息。
方法 #2:lshw 也一样
此工具可报告具有 DMI 功能的 x86 或 IA-64 系统以及某些 PowerPC 机器上的准确内存配置、固件版本、主板配置、CPU 版本和速度、缓存配置、总线速度等。它目前支持 DMI(仅限 x86 和 IA-64)、OpenFirmware 设备树(仅限 PowerPC)、PCI/AGP、CPUID(x86)、IDE/ATA/ATAPI、PCMCIA(仅在 x86 上测试)、SCSI 和 USB。
注意apt-get install lshw:使用“ ”(Debian 和朋友)或“ ”(Red Hat 和朋友)安装 lshw。YMMV yum instal lshw。
列出硬件
在 shell 提示符下输入 lshw:
# lshw | more
或者
# lshw
示例输出:
nas01 description: Computer product: TS-859 PRO (To Be Filled By O.E.M.) vendor: ICP / iEi version: V1.0 serial: To Be Filled By O.E.M. width: 64 bits capabilities: smbios-2.6 dmi-2.6 vsyscall32 configuration: boot=normal family=To Be Filled By O.E.M. sku=To Be Filled By O.E.M. uuid=00020003-0004-0005-0006-000700080009 *-core description: Motherboard product: TS-859 PRO(Q904) vendor: ICP / iEi physical id: 0 version: V1.0 serial: To be filled by O.E.M. slot: To Be Filled By O.E.M. *-firmware description: BIOS vendor: American Megatrends Inc. physical id: 0 version: 080016 date: 04/01/2010 size: 64KiB capacity: 960KiB
要以紧凑格式列出硬件,请输入:
# lshw -short
示例输出:
H/W path Device Class Description ====================================================== system TS-859 PRO (To Be Filled By O.E.M.) /0 bus TS-859 PRO(Q904) /0/0 memory 64KiB BIOS /0/3 processor Intel(R) Atom(TM) CPU D510 @ 1.66GHz /0/3/4 memory 48KiB L1 cache /0/3/5 memory 1MiB L2 cache /0/8 memory 2GiB System Memory /0/8/0 memory 2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns) /0/8/1 memory DIMM [empty] /0/100 bridge Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge /0/100/2 display Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller /0/100/2.1 display Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller /0/100/1a bus 82801I (ICH9 Family) USB UHCI Controller #4 /0/100/1a.1 bus 82801I (ICH9 Family) USB UHCI Controller #5 /0/100/1a.2 bus 82801I (ICH9 Family) USB UHCI Controller #6 /0/100/1a.7 bus 82801I (ICH9 Family) USB2 EHCI Controller #2 /0/100/1c bridge 82801I (ICH9 Family) PCI Express Port 1 /0/100/1c.1 bridge 82801I (ICH9 Family) PCI Express Port 2 /0/100/1c.1/0 eth0 network 82574L Gigabit Network Connection /0/100/1c.2 bridge 82801I (ICH9 Family) PCI Express Port 3 /0/100/1c.2/0 eth1 network 82574L Gigabit Network Connection /0/100/1c.5 bridge 82801I (ICH9 Family) PCI Express Port 6 /0/100/1c.5/0 storage JMB363 SATA/IDE Controller /0/100/1c.5/0.1 storage JMB363 SATA/IDE Controller /0/100/1d bus 82801I (ICH9 Family) USB UHCI Controller #1 /0/100/1d.1 bus 82801I (ICH9 Family) USB UHCI Controller #2 /0/100/1d.2 bus 82801I (ICH9 Family) USB UHCI Controller #3 /0/100/1d.7 bus 82801I (ICH9 Family) USB2 EHCI Controller #1 /0/100/1e bridge 82801 PCI Bridge /0/100/1f bridge 82801IR (ICH9R) LPC Interface Controller /0/100/1f.2 scsi1 storage 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] /0/100/1f.2/0 /dev/sda disk 2TB ST32000641AS /0/100/1f.2/0/1 /dev/sda1 volume 40GiB Linux raid autodetect partition /0/100/1f.2/0/2 /dev/sda2 volume 509MiB Linux raid autodetect partition /0/100/1f.2/0/3 /dev/sda3 volume 500GiB Linux raid autodetect partition /0/100/1f.2/0/4 /dev/sda4 volume 200GiB Linux raid autodetect partition /0/100/1f.2/1 /dev/sdb disk 2TB ST32000641AS /0/100/1f.2/1/1 /dev/sdb1 volume 40GiB Linux raid autodetect partition /0/100/1f.2/1/2 /dev/sdb2 volume 509MiB Linux raid autodetect partition /0/100/1f.2/1/3 /dev/sdb3 volume 500GiB Linux raid autodetect partition /0/100/1f.2/1/4 /dev/sdb4 volume 200GiB Linux raid autodetect partition /0/100/1f.2/2 /dev/sdc disk 2TB ST32000641AS /0/100/1f.2/2/1 /dev/sdc1 volume 40GiB Linux raid autodetect partition /0/100/1f.2/2/2 /dev/sdc2 volume 509MiB Linux raid autodetect partition /0/100/1f.2/2/3 /dev/sdc3 volume 500GiB Linux raid autodetect partition /0/100/1f.2/2/4 /dev/sdc4 volume 200GiB Linux raid autodetect partition /0/100/1f.2/3 /dev/sdd disk 2TB ST2000DM001-1CH1 /0/100/1f.2/3/1 /dev/sdd1 volume 40GiB Linux raid autodetect partition /0/100/1f.2/3/2 /dev/sdd2 volume 509MiB Linux raid autodetect partition /0/100/1f.2/3/3 /dev/sdd3 volume 500GiB Linux raid autodetect partition /0/100/1f.2/3/4 /dev/sdd4 volume 200GiB Linux raid autodetect partition /0/100/1f.2/0.0.0 /dev/sde disk 2TB ST32000641AS /0/100/1f.2/0.0.0/1 /dev/sde1 volume 40GiB Linux raid autodetect partition /0/100/1f.2/0.0.0/2 /dev/sde2 volume 509MiB Linux raid autodetect partition /0/100/1f.2/0.0.0/3 /dev/sde3 volume 500GiB Linux raid autodetect partition /0/100/1f.2/0.0.0/4 /dev/sde4 volume 200GiB Linux raid autodetect partition /0/100/1f.3 bus 82801I (ICH9 Family) SMBus Controller /0/1 scsi10 storage /0/1/0.0.0 /dev/sdf disk 515MB SCSI Disk /0/1/0.0.0/1 /dev/sdf1 volume 491MiB EXT3 volume
要列出系统中的所有磁盘和存储控制器,请键入:
# lshw -class disk -class storage
要以 HTML 格式列出所有网络接口,请输入:
# lshw -html -class network
ls* 命令
使用lspci 命令列出基于 Linux 的系统上的所有 PCI 设备:
# lspci
使用lscpu 命令显示基于 Linux 系统的 CPU 架构信息:
# lscpu
使用lsusb 命令显示基于 Linux 系统的 USB 设备信息:
# lsusb
使用lsscsi 命令列出 Linux 上的 SCSI 设备(或主机)及其属性:
# lsscsi
使用lsb_release 和 uname 命令列出您的发行版和内核版本:
# lsb_release -a
# uname -a
推荐阅读
- ls* 命令比你想象的更有用
- 参见手册页: