linux 操作系统下 dmidecode 命令介绍和使用案例
dmidecode
命令介绍
dmidecode
是一个命令行工具,用于在 Linux 系统中提取硬件信息。它通过读取 DMI(桌面管理接口)表,提供系统硬件的详细信息,包括 BIOS、处理器、内存、主板、机箱等信息。这使得用户可以在不打开机箱的情况下获取系统的硬件配置。
基本用法
dmidecode
命令通常需要以 root 权限运行,以便能够访问 DMI 信息。基本语法如下:
bash
sudo dmidecode [OPTIONS]
常用选项
-t
或--type TYPE
:显示特定类型的信息,例如处理器、内存等。-s
或--string KEYWORD
:仅显示指定 DMI 字符串的值。-q
或--quiet
:以安静模式运行,减少输出信息。-d
或--dev-mem FILE
:从指定的设备文件读取内存,默认是/dev/mem
。-V
或--version
:显示版本信息并退出。
命令介绍
root@meng:/etc/apt# which dmidecode
/usr/sbin/dmidecode
root@meng:/etc/apt# dmidecode --help
Usage: dmidecode [OPTIONS]
Options are:
-d, --dev-mem FILE Read memory from device FILE (default: /dev/mem)
-h, --help Display this help text and exit
-q, --quiet Less verbose output
-s, --string KEYWORD Only display the value of the given DMI string
-t, --type TYPE Only display the entries of given type
-H, --handle HANDLE Only display the entry of given handle
-u, --dump Do not decode the entries
--dump-bin FILE Dump the DMI data to a binary file
--from-dump FILE Read the DMI data from a binary file
--no-sysfs Do not attempt to read DMI data from sysfs files
--oem-string N Only display the value of the given OEM string
-V, --version Display the version and exit
命令案例
查看Bios
dmidecode -t bios
查看处理器
dmidecode -t processor
查看主板
dmidecode -t baseboard
查看机箱