`

我使用过的Linux命令之dmidecode - 查看硬件信息

阅读更多

我使用过的Linux命令之dmidecode - 查看硬件信息

本文链接:http://codingstandards.iteye.com/blog/788984    (转载请注明出处)

用途说明

dmidecode命令用来查看硬件信息。第一次看到这个命令,是在IBM的网站上看到的《“懒惰” Linux 管理员的 10 个关键技巧 》的技巧10 - 随机信息收集。在此之前,我们清查机器的硬件信息时,都需要跑到机房才行,而这个机房并不在我们这个城市。DMI ,即Desktop Management Interface。也有被称为SMBIOS,即System Management BIOS。

常用参数

较低版本的dmidecode命令不支持参数,因此要看信息的话,要用more/less/grep来配合才能更好些。

较高版本的dmidecode命令有如下参数:

-h 查看帮助信息。

-q  不显示未知设备。

-t type   查看指定类型的信息,比如bios,system,memory,processor等。

-s keyword   查看指定的关键字的信息,比如system-manufacturer, system-product-name, system-version, system-serial-number等。

使用示例

示例一 不是每台Linux服务器都能看到硬件信息

[root@web186 root]# dmidecode
# dmidecode 2.2
[root@web186 root]# man dmidecode
man: 没有那个文件或目录
Failed to open the message catalog man on the path NLSPATH=<none>

No manual entry for dmidecode
[root@web186 root]# lsb_release -a
LSB Version:    1.3
Distributor ID: RedHatEnterpriseAS
Description:    Red Hat Enterprise Linux AS release 3 (Taroon Update 4)
Release:        3
Codename:       TaroonUpdate4
[root@web186 root]#

这台机器是台工控机,安装的是RHEL3.4。

示例二 非root用户无法获取硬件信息

[web@hnweb1 ~]$ dmidecode
-bash: dmidecode: command not found
[web@hnweb1 ~]$ whereis dmidecode
dmidecode: /usr/sbin/dmidecode
[web@hnweb1 ~]$ /usr/sbin/dmidecode
/dev/mem: Permission denied
[web@hnweb1 ~]$

 

示例三 服务器DELL2950的硬件信息

[root@sunrise root]# dmidecode
# dmidecode 2.2
SMBIOS 2.4 present.
62 structures occupying 3131 bytes.
Table at 0xCFFBC000.
Handle 0xDA00
        DMI type 218, 11 bytes.
        OEM-specific Type
                Header And Data:
                        DA 0B 00 DA B2 00 17 00 0E 20 00
Handle 0x0000
        DMI type 0, 24 bytes.
        BIOS Information
                Vendor: Dell Inc.
                Version: 1.1.0
                Release Date: 06/21/2006
                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
                        EDD is supported
                        Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
                        5.25"/360 KB floppy services are supported (int 13h)
                        5.25"/1.2 MB floppy services are supported (int 13h)
                        3.5"/720 KB 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
                        BIOS boot specification is supported
                        Function key-initiated network boot is supported
Handle 0x0100
        DMI type 1, 27 bytes.
        System Information
                Manufacturer: Dell Inc.
                Product Name: PowerEdge 2950
                Version: Not Specified
                Serial Number: DYG822X
                UUID: 44454C4C-5900-1047-8038-C4C04F323258
                Wake-up Type: Power Switch
Handle 0x0200
        DMI type 2, 9 bytes.
        Base Board Information
                Manufacturer: Dell Inc.
                Product Name: 0CW954
                Version: A00
                Serial Number: ..CN137406AU00PR.
Handle 0x0300
        DMI type 3, 21 bytes.
        Chassis Information
                Manufacturer: Dell Inc.
                Type: Rack Mount Chassis
                Lock: Present
                Version: Not Specified
                Serial Number: DYG822X
                Asset Tag: Not Specified
                Boot-up State: Safe
                Power Supply State: Safe
                Thermal State: Safe
                Security Status: Unknown
                OEM Information: 0x00000000
Heigth: 2 U
Number Of Power Cords: Unspecified
                Contained Elements: 0
Handle 0x0400
        DMI type 4, 40 bytes.
        Processor Information
                Socket Designation: CPU1
                Type: Central Processor
                Family: Xeon
                Manufacturer: Intel
                ID: F6 06 00 00 FF FB EB BF
                Signature: Type 0, Family 6, Model F, Stepping 6
                Flags:
                        FPU (Floating-point unit on-chip)
                        VME (Virtual mode extension)
                        DE (Debugging extension)
                        PSE (Page size extension)
                        TSC (Time stamp counter)
                        MSR (Model specific registers)
                        PAE (Physical address extension)
                        MCE (Machine check exception)
                        CX8 (CMPXCHG8 instruction supported)
                        APIC (On-chip APIC hardware supported)
                        SEP (Fast system call)
                        MTRR (Memory type range registers)
                        PGE (Page global enable)
                        MCA (Machine check architecture)
                        CMOV (Conditional move instruction supported)
                        PAT (Page attribute table)
                        PSE-36 (36-bit page size extension)
                        CLFSH (CLFLUSH instruction supported)
                        DS (Debug store)
                        ACPI (ACPI supported)
                        MMX (MMX technology supported)
                        FXSR (Fast floating-point save and restore)
                        SSE (Streaming SIMD extensions)
                        SSE2 (Streaming SIMD extensions 2)
                        SS (Self-snoop)
                        HTT (Hyper-threading technology)
                        TM (Thermal monitor supported)
                        SBF (Signal break on FERR)
                Version: Intel(R) Xeon(R) CPU            5130  @ 2.00GHz
                Voltage: 1.4 V
                External Clock: 1333 MHz
                Max Speed: 3600 MHz
                Current Speed: 2000 MHz
                Status: Populated, Enabled
                Upgrade: <OUT OF SPEC>
                L1 Cache Handle: 0x0700
                L2 Cache Handle: 0x0701
                L3 Cache Handle: 0x0702
                Serial Number: Not Specified
                Asset Tag: Not Specified
                Part Number: Not Specified

上面是关于CPU的。

中间省略掉很多输出。
Handle 0x0D00
        DMI type 13, 22 bytes.
        BIOS Language Information
                Installable Languages: 1
                        en|US|iso8859-1
                Currently Installed Language: en|US|iso8859-1
Handle 0x1000
        DMI type 16, 15 bytes.
        Physical Memory Array
                Location: System Board Or Motherboard
                Use: System Memory
                Error Correction Type: Multi-bit ECC
                Maximum Capacity: 32 GB
                Error Information Handle: Not Provided
                Number Of Devices: 8
Handle 0x1100
        DMI type 17, 28 bytes.
        Memory Device
                Array Handle: 0x1000
                Error Information Handle: Not Provided
                Total Width: 72 bits
                Data Width: 64 bits
                Size: 1024 MB
                Form Factor: <OUT OF SPEC>
                Set: 1
                Locator: DIMM1
                Bank Locator: Not Specified
                Type: <OUT OF SPEC>
                Type Detail: Synchronous
                Speed: 667 MHz (1.5 ns)
                Manufacturer: 855180898551
                Serial Number: 050C4921
                Asset Tag: 560639
                Part Number: 72T128420HFN3SA  
上面这一段是关于内存的。

中间省略掉不少输出。
Handle 0x7F00
        DMI type 127, 4 bytes.
        End Of Table
[root@sunrise root]# dmidecode | grep 'Serial Number'    <== 查看机器序列号
                Serial Number: DYG822X
                Serial Number: ..CN137406AU00PR .
                Serial Number: DYG822X
                Serial Number: Not Specified
                Serial Number: Not Specified
                Serial Number: 050C4921
                Serial Number: 050C4926
                Serial Number: 050C4520
                Serial Number: 050C4624
                Serial Number:        
                Serial Number:        
                Serial Number:        
                Serial Number:        
[root@sunrise root]# dmidecode -t processor
-t: No such file or directory

较低版本的dmidecode不支持-t参数。
[root@sunrise root]# dmidecode -h
-h: No such file or directory

较低版本的dmidecode无法查看帮助信息。
[root@sunrise root]# dmidecode | grep CPU
                Socket Designation: CPU1
                Version: Intel(R) Xeon(R) CPU            5130  @ 2.00GHz
                Socket Designation: CPU2
                Version: Intel(R) Xeon(R) CPU            5130  @ 2.00GHz

只能通过grep之类的方式去查询了。
[root@sunrise root]# dmidecode -q
-q: No such file or directory

较低版本的dmidecode不支持-q参数。
[root@sunrise root]#

 

示例四 一台工控机上较新版本的dmidecode可支持参数查询

[root@web ~]# dmidecode -h
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
 -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
 -V, --version          Display the version and exit

不仅可以通过-h参数看到帮助信息,而且man dmidecode也可以看到手册页。
[root@web ~]# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release:        5.5
Codename:       Tikanga
[root@web ~]# dmidecode -t processor
# dmidecode 2.10
SMBIOS 2.4 present.

Handle 0x0005, DMI type 4, 35 bytes
Processor Information
        Socket Designation: Socket 775
        Type: Central Processor
        Family: Core 2 Duo
        Manufacturer: Intel
        ID: F6 06 00 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 15, Stepping 6
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (Fast floating-point save and restore)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Hyper-threading technology)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Core(TM)2
        Voltage: 1.2 V
        External Clock: 266 MHz
        Max Speed: 4000 MHz
        Current Speed: 2394 MHz
        Status: Populated, Enabled
        Upgrade: ZIF Socket
        L1 Cache Handle: 0x000B
        L2 Cache Handle: 0x000C
        L3 Cache Handle: Not Provided
        Serial Number: 
        Asset Tag: 
        Part Number: 

[root@web ~]#

问题思考

1. 怎样升级Linux系统上的dmidecode,以便看到详细的硬件信息?

相关资料

【1】飘渺的风 Linux硬件信息查看工具dmidecode

【2】IBM “懒惰” Linux 管理员的 10 个关键技巧

【3】lamp fans notes Dmidecode linux下 获取一些硬件参数的命令(转)

【4】Linux-Wiki.cn 查看硬件详细信息

【5】Linux纪录地 linux有用但不常用小工具(dmidecode\ethtool\ulimit\等)

 

返回 我使用过的Linux命令系列总目录

 

0
0
分享到:
评论

相关推荐

    Linux 下dmidecode查看内存条数的命令介绍

    有关dmidecode命令的详细用法,请参考这篇文章:linux查看主板内存槽与内存信息的命令dmidecode 。 以上就是小编为大家带来的Linux 下dmidecode查看内存条数的命令介绍全部内容了,希望大家多多支持软件开发网~ 您...

    新手入门级linux系统常用命令大全

    Linux命令学习是大多数新手的最大障碍,今天为大家分享一些Linux系统下常用的基础命令,linux常用命令全集 Linux系统信息命令 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在...

    linux命令大全

    有用的Linux命令方便学习 部分展示 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /...

    linux常用命令大全.txt

    系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器...dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作

    Linux查看服务器硬件信息的方法步骤

    今天给大家带来的是《Linux查看服务器上的硬件信息》本篇文章的示例全部是在服务器(Inspur SA5112M4)上实现的,有些命令在虚拟机上达不到效果 查看服务器型号、序列号 root@zhangdaifu# dmidecode -s system-...

    kali linux命令.txt

    kali linux 命令集: 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列...

    Linux常用命令大全

    dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts ...

    linux系统命令大全

    linux系统常用命令大全:系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI)

    Linux黑客命令行.docx

    dmidecode -q 显示硬件系统部件-(SMBIOS/DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts ...

    Linux获取服务器硬件配置(CPU、内存、硬盘、主板)信息shell 脚本

    该脚本使用了以下命令: cat /proc/cpuinfo: 获取 CPU 信息。 grep: 在文件中搜索...dmidecode: 一个工具,用于从 DMI 表中读取硬件信息。 使用该脚本,你可以获得 CPU、内存、硬盘、PCIe 设备、主板以及 厂商信息。

    linux常用指令

    dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI)  hdparm -i /dev/hda 罗列一个磁盘的架构特性  hdparm -tT /dev/sda 在磁盘上执行测试性读取操作  cat /proc/cpuinfo 显示CPU info的信息  cat /proc/...

    基于Linux系统中查看硬件等信息的方法详解

    #使用命令dmidecode | grep -i ‘serial number’#查看板卡信息cat /proc/pci 2,cpu信息 #通过/proc文件系统1) cat /proc/cpuinfo#通过查看开机信息2) dmesg | grep -i ‘cpu’#3)dmidecode -t processor3,在...

    linux常用命令

    dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts ...

    Linux命令大全

    dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts ...

    2020非常全的软件测试linux常用命令全集,linux面试题及参考答案

    我相信大部分的人都和Linux打过交道,因为我们的服务器一般都是装的Linux操作系统,包括各种云服务器也都是用的Linux,目前主流是CentOS7,那么对于一个测试工程师来说,我们需要掌握哪些命令呢?我将我了解到的命令...

    java获取系统、硬件、设备相关信息

    java 1. 使用wmic相关命令获取windows硬件相关信息。 2. 使用shell相关的dmidecode/fdisk/ifconfig命令获取Linux硬件和系统相关信息

    Linux命令大全(精编).pdf

    arch显示机器的处理器架构(1)uname-m显示机器的处理器架构(2)uname-r显示正在使用的内核版本dmidecode-q显示硬件系统部件-(SMBIOS/DMI)hdparm-i/dev/hda罗列一个磁盘的架构特性

Global site tag (gtag.js) - Google Analytics