linux command – hwinfo

透過 hwinfo 的功能可以檢視系統的硬體設施. 包括 arch, bios, block, bluetooth, braille, bridge, camera, cdrom, chipcard, cpu, disk, dsl, dvb, fingerprint, floppy, framebuffer, gfxcard, hub, ide, isapnp, isdn, joystick, keyboard, memory, modem, monitor, mouse, netcard, network, partition, pci, pcmcia, pcmcia-ctrl, pppoe, printer, redasd, reallyall, scanner, scsi, smp, sound, storage-ctrl, sys, tape, tv, uml, usb, usb-ctrl, vbe, wlan, xen, zip 等…..

測試環境為 Ubuntu 16.04 x86_64

hwinfo非預設安裝,在 Ubuntu 下可以直接透過 apt 來安裝.

root@ubuntu:~# apt install hwinfo
root@ubuntu:~# hwinfo --help
Usage: hwinfo [OPTIONS]
Probe for hardware.
Options:
    --<HARDWARE_ITEM>
        This option can be given more than once. Probe for a particular HARDWARE_ITEM. Available hardware items are: all, arch, bios, block, bluetooth, braille, bridge, camera, cdrom, chipcard, cpu, disk, dsl, dvb, fingerprint, floppy, framebuffer, gfxcard, hub, ide, isapnp, isdn, joystick, keyboard, memory, modem, monitor, mouse, netcard, network, partition, pci, pcmcia, pcmcia-ctrl, pppoe, printer, redasd, reallyall, scanner, scsi, smp, sound, storage-ctrl, sys, tape, tv, uml, usb, usb-ctrl, vbe, wlan, xen, zip
    --short
        Show only a summary. Use this option in addition to a hardware probing option.
    --listmd
        Normally hwinfo does not report RAID devices. Add this option to see them.
    --only DEVNAME
        This option can be given more than once. If you add this option, only data about devices with DEVNAME will be shown.
    --save-config SPEC
        Store config  for a particular device below /var/lib/hardware. SPEC can be a device name, an UDI, or 'all'. This option must be given in addition to a hardware probing option.
    --show-config UDI
        Show saved config data for a particular device.
    --map
        If disk names have  changed (e.g. after a kernel update) this prints a list of disk name mappings. Note  that  you must have used --save-config at some point before for this can work.
    --debug N
        Set debug level to N. The debug info is shown only in the log file. If you specify a log file, the debug level is implicitly set to a reasonable value.
    --verbose
        Increase verbosity. Only together with --map.
    --log FILE
        Write log info to FILE.
    --dump-db N
        Dump hardware data base. N is either 0 for the external data base in /var/lib/hardware, or 1 for the internal data base.
    --version
        Print libhd version.
    --help
        Print usage.

預設 #hwinfo 等於 # hwinfo –all

hwinfo [OPTIONS] —
可以檢視的裝置名稱如下:
all, arch, bios, block, bluetooth, braille, bridge, camera, cdrom, chipcard, cpu, disk, dsl, dvb, fingerprint, floppy, framebuffer, gfxcard, hub, ide, isapnp, isdn, joystick, keyboard, memory, modem, monitor, mouse, netcard, network, partition, pci, pcmcia, pcmcia-ctrl, pppoe, printer, redasd, reallyall, scanner, scsi, smp, sound, storage-ctrl, sys, tape, tv, uml, usb, usb-ctrl, vbe, wlan, xen, zip

root@ubuntu:~# hwinfo --arch
Arch: X86_64/grub  
root@ubuntu:~# hwinfo --cpu
01: None 00.0: 10103 CPU                                        
  [Created at cpu.460]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.58.9 "Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz"
  Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,mmx,fxsr,sse,sse2,ss,syscall,nx,rdtscp,lm,constant_tsc,arch_perfmon,nopl,xtopology,tsc_reliable,nonstop_tsc,cpuid,pni,pclmulqdq,ssse3,cx16,pcid,sse4_1,sse4_2,x2apic,popcnt,tsc_deadline_timer,aes,xsave,avx,f16c,rdrand,hypervisor,lahf_lm,cpuid_fault,pti,fsgsbase,tsc_adjust,smep,arat
  Clock: 2294 MHz
  BogoMips: 4589.18
  Cache: 3072 kb
  Config Status: cfg=new, avail=yes, need=no, active=unknown

如果嫌資訊太多,可以使用 參數 –short 用以顯示簡易的資訊即可.

root@ubuntu:~# hwinfo --short --arch --cpu
cpu:                                                            
                       Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz, 2294 MHz
                       Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz, 2294 MHz

剛剛的裝置名稱可以同時檢視.

root@ubuntu:~# hwinfo --short --usb --cpu
cpu:                                                            
                       Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz, 2294 MHz
                       Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz, 2294 MHz
mouse:
                       VMware Virtual Mouse
hub:
                       VMware Virtual USB Hub
                       Linux Foundation 2.0 root hub
                       Linux Foundation 1.1 root hub
bluetooth:
                       VMware Virtual Bluetooth Adapter
unknown:
                       VMware Virtual USB Video Device

或是把資訊導入到檔案裡面.

root@ubuntu:~# hwinfo --all --log hardware_info.txt

其他可以完整系統硬體資訊

  • #lshw (list Hardware)http://benjr.tw/53000
    透過 lshw 的功能可以檢視系統的硬體設施. 包括記憶體組態 (memory configuration),韌體版本 (firmware version),主機板組態 (mainboard configuration),處理器版本以及速度 (CPU version and speed),快取組態 (cache configuration),匯流排速度 (bus speed), 等…..
  • #discoverhttp://benjr.tw/95257
    功能類似於 lshw 功能可以檢視系統的硬體設施.
  • #hwlochttp://benjr.tw/98373
    hwloc (Portable Hardware Locality) 功能類似於 lshw 功能可以檢視系統的硬體設施,但除了文字介面外還提供了系統的架構圖可供檢視.

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料