Linux dmidecode -查看硬件信息

本文介绍了dmidecode命令的功能及用法,包括查看硬件信息、BIOS信息、内存配置等,并对比了不同版本间的差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用途说明

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

常用参数

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

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

-h 查看帮助信息。

-q 不显示未知设备。

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

-skeyword   查看指定的关键字的信息,比如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 themessage catalog man on the path NLSPATH=<none>

 

No manual entry fordmidecode

[root@web186 root]# lsb_release -a

LSBVersion:    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: Permissiondenied

[web@hnweb1 ~]$

 

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

[root@sunrise root]#dmidecode

# dmidecode 2.2

SMBIOS 2.4 present.

62 structuresoccupying 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 PowerCords: 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@sunriseroot]# 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 ordirectory

较低版本的dmidecode不支持-t参数。

[root@sunrise root]#dmidecode -h

-h: No such file ordirectory

较低版本的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 ordirectory

较低版本的dmidecode不支持-q参数。

[root@sunrise root]#

 

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

[root@web ~]# dmidecode -h

Usage: dmidecode[OPTIONS]

Options are:

 -d, --dev-memFILE     Read memory from device FILE (default: /dev/mem)

 -h,--help            Display this help text and exit

 -q,--quiet            Lessverbose output

 -s, --stringKEYWORD   Only display the value of the given DMI string

 -t, --typeTYPE        Only display the entries ofgiven 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 theversion and exit

不仅可以通过-h参数看到帮助信息,而且man dmidecode也可以看到手册页。

[root@web ~]# lsb_release -a

LSBVersion:   :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, DMItype 4, 35 bytes

ProcessorInformation

       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 ~]#

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值