关于如何在linux下 查看设备 型号、属性

    dmidecode是一个十分有用的工具,它可以全面的显示你系统的信息,包括bios、cpu、内存等信息。目前最新版本为2.9,可以在http://www.nongnu.org/dmidecode/ 下载到。
    用dmidecode可以显示非常详细的硬件信息。
    另外,还有些小技巧。
    比如,显示有几条内存:
[root@localhost dmidecode-2.9]# dmidecode |grep -A12 "Memory Device$"
        Memory Device
                Array Handle: 0x1000
                Error Information Handle: Not Provided
                Total Width: 72 bits
                Data Width: 64 bits
                Size: No Module Installed
                Form Factor: DIMM
                Set: 1
                Locator: DIMM 01
                Bank Locator: Not Specified
                Type: SDRAM
                Type Detail: Synchronous
                Speed: 100 MHz (10.0 ns)
--
        Memory Device
                Array Handle: 0x1000
                Error Information Handle: Not Provided
                Total Width: 72 bits
                Data Width: 64 bits
                Size: 512 MB
                Form Factor: DIMM
                Set: 1
                Locator: DIMM 02
                Bank Locator: Not Specified
                Type: SDRAM
                Type Detail: Synchronous
                Speed: 133 MHz (7.5 ns)
--
        Memory Device
                Array Handle: 0x1000
                Error Information Handle: Not Provided
                Total Width: 72 bits
                Data Width: 64 bits
                Size: 128 MB
                Form Factor: DIMM
                Set: 2
                Locator: DIMM 03
                Bank Locator: Not Specified
                Type: SDRAM
                Type Detail: Synchronous
                Speed: 133 MHz (7.5 ns)
--
        Memory Device
                Array Handle: 0x1000
                Error Information Handle: Not Provided
                Total Width: 72 bits
                Data Width: 64 bits
                Size: 128 MB
                Form Factor: DIMM
                Set: 2
                Locator: DIMM 04
                Bank Locator: Not Specified
                Type: SDRAM
                Type Detail: Synchronous
                Speed: 133 MHz (7.5 ns)
    A12是显示包含关键字的行的后续12行
    $是行结束符   
    还看到一种更简洁的方法—— dmidecode | grep MB 试过就知道了:)
    显示CPU的详细信息:
    dmidecode |grep -A42 "Processor"|less

    查看,主板的序列号
    [root@localhost dmidecode-2.9]# dmidecode |grep 'Serial Number'
                Serial Number: 5M1AJVQ2C006
                Serial Number: 5M1AJVQ2C006
    [root@localhost dmidecode-2.9]# dmidecode | grep 'Serial Number' | awk '{print $3}' | tail -1
    5M1AJVQ2C006

    tail -1表示显示最后一行

你可能感兴趣的:(Linux/GNU应用)