在 Linux 下查看系统及硬件资讯十分实用, 可以在安装新套件或驱动程式时找出相容性问题, 以下会介绍在 Linux 下查看系统及硬件资讯的方法。
1. 透过 uname 查看系统资讯:
找行 “uname” 会显示系统名称:
Linux
查看 kernel 版本:
3.10.0-229.14.1.el7.x86_64
显示系统的架构:
x86_64
显示全部资讯:
Linux localhost 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Sep 15 15:05:51 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2. 查看硬件资讯
lshw 是一个透过读取 /proc 里面的档案, 撷取硬件资讯的工具, 执行 lshw 需要有 root 权限。
安装 lshw:
要显示所有硬件资讯, 直接执行 lshw:
上面的指令会显示所有资讯, 十分详尽, 如果只想显示硬件的概要资讯, 可以加上 -short 参数:
3. 显示 CPU 资讯
系统内的 CPU 资讯可以在 /proc/cpuinfo 档案查看, 而 lscpu 会透过 /proc/cpuinfo 显示 CPU 的数量, 核心数量, CPU 类型等资讯:
4. 查看 Linux Block Device 资讯:
5. 查看 USB Controllers 资讯
6. 查看 PCI 装置资讯
7. 查看 SCSI 装置资讯
安装 lsscsi:
RHEL, CentOS:
Fedora:
Debian, Ubuntu:
执行 lsscsi:
8. 撷取硬件元件
可以透过 dmidecode 撷取硬件的元件资讯, 例如撷取内存的资讯:
撷取系统资讯:
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0002, DMI type 1, 27 bytes
System Information
Manufacturer: Dell
Product Name: CS24-TY
Version: A00
Serial Number: 2RBSMH1
UUID: 44454C4C-5200-1042-8053-B2C04F4D4831
Wake-up Type: Power Switch
SKU Number: To Be Filled By O.E.M.
Family: Server
Handle 0x0048, DMI type 32, 20 bytes
System Boot Information
Status: No errors detected
撷取 BIOS 资讯:
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0001, DMI type 0, 24 bytes
BIOS Information
Vendor: Dell Computer Corporation
Version: S99C3B22
Release Date: 08/30/2011
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 4096 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
Print screen service is supported (int 5h)
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
Function key-initiated network boot is supported
Targeted content distribution is supported
BIOS Revision: 8.16
Handle 0x0033, DMI type 13, 22 bytes
BIOS Language Information
Language Description Format: Long
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1