python-hwinfo : Display summary of Hardware information using standard Linux utilities

Till date, we have covered most of the utilities which discover Linux system hardware information & configuration but still there are plenty of commands available for this purpose.

In that, some of the utilities are display detailed information about all the hardware components and reset will shows only specific device information.

In this series, today we are going to discuss about python-hwinfo, it is one of the tool that display summary of hardware information and it’s configuration in the neat way.

What’s python-hwinfo

This is a python library for inspecting hardware and devices by parsing the outputs of system utilities such as lspci and dmidecode.

It’s offering a simple CLI toll which can be used for inspect local, remote and captured hosts. Run the command with sudo to get maximum information.

Additionally you can execute this on remote server by providing a Server IP or Host name, username, and password. Also you can use this tool to view other utilities captured outputs like demidecode as ‘dmidecode.out’, /proc/cpuinfo as ‘cpuinfo’, lspci -nnm as ‘lspci-nnm.out’, etc,.

Suggested Read :
(#) inxi – A Great Tool to Check Hardware Information on Linux
(#) Dmidecode – Easy Way To Get Linux System Hardware Information
(#) LSHW (Hardware Lister) – A Nifty Tool To Get A Hardware Information On Linux
(#) hwinfo (Hardware Info) – A Nifty Tool To Detect System Hardware Information On Linux
(#) How To Use lspci, lsscsi, lsusb, And lsblk To Get Linux System Devices Information

How to install python-hwinfo in Linux

It can be installed through pip package to all major Linux distributions. In order to install python-hwinfo, Make sure your system have python and python-pip packages as a prerequisites.

pip is a python module bundled with setuptools, it’s one of the recommended tool for installing Python packages in Linux.

For Debian/Ubuntu, use APT-GET Command or APT Command to install pip.

$ sudo apt install python-pip

For RHEL/CentOS, use YUM Command to install pip.

$ sudo yum install python-pip python-devel

For Fedora, use DNF Command to install pip.

$ sudo dnf install python-pip

For Arch Linux, use Pacman Command to install pip.

$ sudo pacman -S python-pip

For openSUSE, use Zypper Command to install pip.

$ sudo zypper python-pip

Finally, Run the following pip command to install python-hwinfo.

$ sudo pip install python-hwinfo

How to use python-hwinfo in local machine

Execute the following command to inspect the hardware present on a local machine. The output is much clear and neat which I didn’t see in any other commands.

It’s categorized the output in five classes.

  • Bios Info: It’s contains bios_vendor_name, system_product_name, system_serial_number, system_uuid, system_manufacturer, bios_release_date, and bios_version
  • CPU Info: It’s display no of processor, vendor_id, cpu_family, model, stepping, model_name, and cpu_mhz
  • Ethernet Controller Info: It’s shows device_bus_id, vendor_name, vendor_id, device_name, device_id, subvendor_name, subvendor_id, subdevice_name, and subdevice_id
  • Storage Controller Info: It’s shows vendor_name, vendor_id, device_name, device_id, subvendor_name, subvendor_id, subdevice_name, and subdevice_id
  • GPU Info: It’s shows vendor_name, vendor_id, device_name, device_id, subvendor_name, subvendor_id, subdevice_name, and subdevice_id
$ sudo hwinfo

Bios Info:

+----------------------+--------------------------------------+
| Key                  | Value                                |
+----------------------+--------------------------------------+
| bios_vendor_name     | IBM                                  |
| system_product_name  | System x3550 M3: -[6102AF1]-         |
| system_serial_number | RS2IY21                              |
| chassis_type         | Rack Mount Chassis                   |
| system_uuid          | 4C4C4544-0051-3210-8052-B2C04F323132 |
| system_manufacturer  | IBM                                  |
| socket_count         | 2                                    |
| bios_release_date    | 10/21/2014                           |
| bios_version         | -[VLS211TSU-2.51]-                   |
| socket_designation   | Socket 1, Socket 2                   |
+----------------------+--------------------------------------+

CPU Info:

+-----------+--------------+------------+-------+----------+------------------------------------------+----------+
| processor |  vendor_id   | cpu_family | model | stepping |                model_name                | cpu_mhz  |
+-----------+--------------+------------+-------+----------+------------------------------------------+----------+
|     0     | GenuineIntel |     6      |   45  |    7     | Intel(R) Xeon(R) CPU E5-1607 0 @ 3.00GHz | 1200.000 |
|     1     | GenuineIntel |     6      |   45  |    7     | Intel(R) Xeon(R) CPU E5-1607 0 @ 3.00GHz | 1200.000 |
|     2     | GenuineIntel |     6      |   45  |    7     | Intel(R) Xeon(R) CPU E5-1607 0 @ 3.00GHz | 1200.000 |
|     3     | GenuineIntel |     6      |   45  |    7     | Intel(R) Xeon(R) CPU E5-1607 0 @ 3.00GHz | 1200.000 |
|     4     | GenuineIntel |     6      |   45  |    7     | Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz | 1200.000 |
+-----------+--------------+------------+-------+----------+------------------------------------------+----------+

Ethernet Controller Info:

+-------------------+-----------+---------------------------------+-----------+-------------------+--------------+---------------------------------+--------------+
|    vendor_name    | vendor_id |           device_name           | device_id |   subvendor_name  | subvendor_id |          subdevice_name         | subdevice_id |
+-------------------+-----------+---------------------------------+-----------+-------------------+--------------+---------------------------------+--------------+
| Intel Corporation |    8086   | I350 Gigabit Network Connection |    1521   | Intel Corporation |     8086     | I350 Gigabit Network Connection |     1521     |
+-------------------+-----------+---------------------------------+-----------+-------------------+--------------+---------------------------------+--------------+

Storage Controller Info:

+-------------------+-----------+----------------------------------------------+-----------+----------------+--------------+----------------+--------------+
|    vendor_name    | vendor_id |                 device_name                  | device_id | subvendor_name | subvendor_id | subdevice_name | subdevice_id |
+-------------------+-----------+----------------------------------------------+-----------+----------------+--------------+----------------+--------------+
| Intel Corporation |    8086   |   C600/X79 series chipset IDE-r Controller   |    1d3c   |      Dell      |     1028     | [Device 05d2]  |     05d2     |
| Intel Corporation |    8086   | C600/X79 series chipset SATA RAID Controller |    2826   |      Dell      |     1028     | [Device 05d2]  |     05d2     |
+-------------------+-----------+----------------------------------------------+-----------+----------------+--------------+----------------+--------------+

GPU Info:

+--------------------+-----------+-----------------------+-----------+--------------------+--------------+----------------+--------------+
|    vendor_name     | vendor_id |      device_name      | device_id |   subvendor_name   | subvendor_id | subdevice_name | subdevice_id |
+--------------------+-----------+-----------------------+-----------+--------------------+--------------+----------------+--------------+
| NVIDIA Corporation |    10de   | GK107GL [Quadro K600] |    0ffa   | NVIDIA Corporation |     10de     | [Device 094b]  |     094b     |
+--------------------+-----------+-----------------------+-----------+--------------------+--------------+----------------+--------------+

How to use python-hwinfo in remote machine

Execute the following command to inspect the hardware present on a remote machine which required remote server IP, username, and password.

$ hwinfo -m x.x.x.x -u root -p password

How to use python-hwinfo to read captured outputs

Execute the following command to inspect the hardware present on a local machine. The output is much clear and neat which we  didn’t see in any other commands.

$ hwinfo -f [Path to file]

Leave a Reply

Your email address will not be published. Required fields are marked *