Hardware Queries

Several Linux utilities exist for querying and, in some cases, setting the system’s hardware. Run these utilities as root.


dmidecode(8) --- dnf install dmidecode

DMI stands for Desktop Management Interface. This app dumps a great deal of information about the BIOS. Scrolling through the huge output is informative, but narrowing it down with certain options will be more helpful. The -s option uses string keywords to narrow the list. Use -s without an argument to get a list of possible type names. For example:

$ sudo dmidecode -s processor-version
Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz

A -t option uses type keywords to narrow the list to specific groups. Without an argument, -t gives the available group names. The -t option can also take handle numbers. One convenient fact for Dells, handle number 1 (-t 1) shows the primary system information including the serial number to use for Dell hardware support. Don’t need to turn the laptop upside down to look for the serial number sticker.

biosdecode(8)

Parses BIOS memory showing its entry points, such as ACPI, SMBIOS, PNP, PCI, and a variety of facts about them.

ownership(8)

Use this for Compaq only.

vpddecode(8)

Use this for IBM and Lenovo only.


lshw(1) & lshw-gui --- dnf install lshw lshw-gui

This gives a tree-structured listing of the installed hardware. A variety of formatting options are available, but use lshw -short or lshw -businfo for overviews. The lshw-gui, a separate package, requires lots of clicking through the tree structure to see the detail. The list is extensive. To shorten it, here are samples from a Qubes Disposable VM:

$ sudo lshw -sanitize
computer
    description: Computer
    width: 64 bits
    capabilities: vsyscall32
  *-core
       description: Motherboard
       physical id: 0
     *-memory
          description: System memory
          physical id: 0
          size: 311MiB
     *-cpu
          product: Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
          vendor: Intel Corp.
          physical id: 1
          bus info: cpu@0
          width: 64 bits
          capabilities: fpu fpu_exception wp de tsc msr pae cx8 apic sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx x86-64 constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb pln pts dtherm fsgsbase erms xsaveopt
  *-usbhost
       product: Dummy host controller
       vendor: Linux 4.4.67-12.pvops.qubes.x86_64 dummy_hcd
       physical id: 1
       bus info: usb@1
       logical name: usb1
       version: 4.04
       capabilities: usb-2.00
       configuration: driver=hub slots=1 speed=480Mbit/s
  *-network
       description: Ethernet interface
       physical id: 2
       logical name: eth0
       serial: [REMOVED]
       capabilities: ethernet physical
       configuration: broadcast=yes driver=vif ip=[REMOVED] link=yes multicast=yes

Here is output using the -short option:

$ sudo lshw -short
H/W path  Device  Class      Description
========================================
                  system     Computer
/0                bus        Motherboard
/0/0              memory     311MiB System memory
/0/1              processor  Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
/1        usb1    bus        Dummy host controller
/2        eth0    network    Ethernet interface

A sample of the -businfo option:

$ sudo lshw -businfo
Bus info  Device  Class      Description
========================================
                  system     Computer
                  bus        Motherboard
                  memory     311MiB System memory
cpu@0             processor  Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
usb@1     usb1    bus        Dummy host controller
          eth0    network    Ethernet interface

lspci(8) --- dnf install pciutils

This is one of the more well-known utilities, summarizing the connected PCI bus hardware. Using this, you can find out the manufacturer and model of various devices installed, such as graphics, network, and other controllers. Graphics controllers are typically labeled VGA. Network controllers may be labeled Ethernet for wired connections and Network for wireless connections. Greater detail is available with -v, -vv, and -vvv options. Associated kernel drivers used show with the -k option.


lsusb(8) --- dnf install usbutils

Display detailed info about the USB devices. Without options, it simply lists all the USB buses and devices in an easily parsed form. The verbose option (-v) gives much more detail. The tree option (-t) overrides the -v option but shows the relations of multiple ports. Following shows a plain list followed by the tree form of the same list:

$ sudo lsusb
Bus 002 Device 003: ID 147e:1001 Upek TCS5B Fingerprint sensor
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ sudo lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M 
        |__ Port 5: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
 /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

ethtool(8) --- dnf install ethtool

Used to find or configure various network settings. Use the device name as given by ifconfig(8). A quick way to get the device names is:

$ ifconfig | egrep ': ' | cut -d: -f1

This isolates the lines with a colon-space — only the name lines have that — and then isolates the name in front of the colon. For example:

$ sudo for n in $(ifconfig | egrep ': ' | cut -d: -f1); do ethtool $n; done
Settings for enp3s0f0:
         Supported ports: [ TP MII ]
         Supported link modes:   10baseT/Half 10baseT/Full
                                 100baseT/Half 100baseT/Full 
                                 1000baseT/Half 1000baseT/Full
         Supported pause frame use: No
         Supports auto-negotiation: Yes
         Advertised link modes:  10baseT/Half 10baseT/Full
                                 100baseT/Half 100baseT/Full
                                 1000baseT/Half 1000baseT/Full
         Advertised pause frame use: Symmetric Receive-only
         Advertised auto-negotiation: Yes
         Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                              100baseT/Half 100baseT/Full
                                              1000baseT/Half 1000baseT/Full
         Link partner advertised pause frame use: Symmetric Receive-only
         Link partner advertised auto-negotiation: Yes
         Speed: 1000Mb/s
         Duplex: Full
         Port: MII
         PHYAD: 1
         Transceiver: internal
         Auto-negotiation: on
         Supports Wake-on: pg
         Wake-on: g
         Current message level: 0x000020c6 (8390)
                                probe link rx_err tx_err hw
         Link detected: yes
 Settings for lo:
         Link detected: yes
 Settings for virbr0:
         Link detected: no
 Settings for wlp4s0:
         Link detected: yes

Query the driver:

$ sudo for n in $(ifconfig | egrep ': ' | cut -d: -f1); do echo; echo $n:; ethtool -i $n; done

enp3s0f0:
driver: jme
version: 1.0.8
firmware-version:
expansion-rom-version:
bus-info: 0000:03:00.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

lo:
Cannot get driver information: Operation not supported

virbr0:
driver: bridge
version: 2.3
firmware-version: N/A
expansion-rom-version:
bus-info: N/A
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

wlp4s0:
driver: iwlwifi
version: 4.11.3-202.fc25.x86_64
firmware-version: 9.221.4.1 build 25532
expansion-rom-version:
bus-info: 0000:04:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

Statistics are available:

$ sudo ethtool -S wlp4s0
NIC statistics:
     rx_packets: 3628770
     rx_bytes: 421552716
     rx_duplicates: 4
     rx_fragments: 1935504
     rx_dropped: 222
     tx_packets: 4625
     tx_bytes: 150501
     tx_filtered: 0
     tx_retry_failed: 0
     tx_retries: 798
     sta_state: 4
     txrate: 1000000
     rxrate: 1000000
     signal: 231
     channel: 0
     noise: 18446744073709551615
     ch_time: 18446744073709551615
     ch_time_busy: 18446744073709551615
     ch_time_ext_busy: 18446744073709551615
     ch_time_rx: 18446744073709551615
     ch_time_tx: 18446744073709551615

 

Leave a Comment