Tuesday, April 8, 2014

Check hardware information on Linux with hwinfo command

http://www.binarytides.com/linux-hwinfo-command

Hwinfo

The hwinfo command is a very handy command line tool that can be used to probe for details about hardware components. It reports information about most hardware units like cpu, hdd controllers, usb controllers, network card, graphics cards, multimedia, printers etc.



Hwinfo depends on the libhd library to gather hardware information which depends on libhal.
linux hwinfo command
Hwinfo is available in the repositories of Ubuntu and Debian.
# ubuntu, debian
$ sudo apt-get install hwinfo
To install Hwinfo on Fedora or CentOS follow this post
How to install hwinfo on Fedora 19/20 and CentOS 5/6

Using hwinfo

The help information explains how to use it
$ hwinfo --help
Usage: hwinfo [options]
Probe for hardware.
  --short        just a short listing
  --log logfile  write info to logfile
  --debug level  set debuglevel
  --version      show libhd version
  --dump-db n    dump hardware data base, 0: external, 1: internal
  --hw_item      probe for hw_item
  hw_item is one of:
   all, 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,
   scanner, scsi, smp, sound, storage-ctrl, sys, tape, tv, usb, usb-ctrl,
   vbe, wlan, zip

  Note: 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.)
The options are few, just mention the hardware item for which you would like to see the information and it would display that only.

1. Display all information

Running hwinfo without any options would display detailed information about all hardware units
$ hwinfo

2. Display brief information

The "--short" option will display brief information about the hardware and not the details
$ hwinfo --short
Here is the output from my system
cpu:
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHz
keyboard:
  /dev/input/event2    AT Translated Set 2 keyboard
mouse:
  /dev/input/mice      Microsoft Basic Optical Mouse v2.0
graphics card:
                       Intel 965G-1
                       Intel 82G35 Express Integrated Graphics Controller
sound:
                       Intel 82801H (ICH8 Family) HD Audio Controller
storage:
                       Intel 82801H (ICH8 Family) 4 port SATA IDE Controller
                       Intel 82801H (ICH8 Family) 2 port SATA IDE Controller
                       JMicron JMB368 IDE controller
network:
  eth0                 Intel 82566DC Gigabit Network Connection
network interface:
  eth0                 Ethernet network interface
  lo                   Loopback network interface
disk:
  /dev/sda             ST3500418AS
partition:
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sda5            Partition
  /dev/sda6            Partition
  /dev/sda7            Partition
  /dev/sda8            Partition
cdrom:
  /dev/sr0             SONY DVD RW DRU-190A
usb controller:
                       Intel 82801H (ICH8 Family) USB UHCI Controller #4
                       Intel 82801H (ICH8 Family) USB UHCI Controller #5
                       Intel 82801H (ICH8 Family) USB2 EHCI Controller #2
                       Intel 82801H (ICH8 Family) USB UHCI Controller #1
                       Intel 82801H (ICH8 Family) USB UHCI Controller #2
                       Intel 82801H (ICH8 Family) USB UHCI Controller #3
                       Intel 82801H (ICH8 Family) USB2 EHCI Controller #1
bios:
                       BIOS
bridge:
                       Intel 82G35 Express DRAM Controller
                       Intel 82801H (ICH8 Family) PCI Express Port 1
                       Intel 82801H (ICH8 Family) PCI Express Port 2
                       Intel 82801H (ICH8 Family) PCI Express Port 3
                       Intel 82801 PCI Bridge
                       Intel 82801HB/HR (ICH8/R) LPC Interface Controller
hub:
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic ehci_hcd EHCI Host Controller
                       Linux 3.11.0-12-generic ehci_hcd EHCI Host Controller
memory:
                       Main Memory
firewire controller:
                       Agere FW323
unknown:
                       FPU
                       DMA controller
                       PIC
                       Timer
                       Keyboard controller
                       Intel 82801H (ICH8 Family) SMBus Controller
                       Serial controller



Save it to a file
$ hwinfo --short > hardware_brief.txt

3. View CPU details

With the "--cpu" option, hwinfo would display only cpu information.
$ hwinfo --short --cpu
cpu:                                                            
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
Remove the short option to display detailed information, about the cpu.

4. Display network card information

$ sudo hwinfo --short --netcard
network:                                                        
  eth0                 Intel 82566DC Gigabit Network Connection

5. Storage devices and partitions

[term] $ sudo hwinfo --short --block disk: /dev/sda ST3500418AS partition: /dev/sda1 Partition /dev/sda2 Partition /dev/sda5 Partition /dev/sda6 Partition /dev/sda7 Partition /dev/sda8 Partition cdrom: /dev/sr0 SONY DVD RW DRU-190A

6. Hard drive controllers

$ sudo hwinfo --short --storage
storage:                                                        
                       Intel 82801H (ICH8 Family) 4 port SATA IDE Controller
                       Intel 82801H (ICH8 Family) 2 port SATA IDE Controller
                       JMicron JMB368 IDE controller

7. USB devices and controllers

$ sudo hwinfo --short --usb
mouse:                                                          
  /dev/input/mice      Microsoft Basic Optical Mouse v2.0
hub:
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic ehci_hcd EHCI Host Controller
                       Linux 3.11.0-12-generic ehci_hcd EHCI Host Controller

8. Display multiple devices together

To display multiple hardware units together, just add all the options
$ sudo hwinfo --short --usb --cpu --block
cpu:                                                            
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHz
                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz
mouse:
  /dev/input/mice      Microsoft Basic Optical Mouse v2.0
disk:
  /dev/sda             ST3500418AS
partition:
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sda5            Partition
  /dev/sda6            Partition
  /dev/sda7            Partition
  /dev/sda8            Partition
cdrom:
  /dev/sr0             SONY DVD RW DRU-190A
hub:
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic uhci_hcd UHCI Host Controller
                       Linux 3.11.0-12-generic ehci_hcd EHCI Host Controller
                       Linux 3.11.0-12-generic ehci_hcd EHCI Host Controller

9. Log information to a file

The hwinfo has an option to log all data to a file. The following command will log detailed information about all hardware units to a text file.
$ hwinfo --all --log hardware_info.txt
To log short information in addition to the detailed information, add the "short" option too. Not sure if it is supposed to work like that.
$ hwinfo --all --short --log hardware_info.txt

No comments:

Post a Comment