| Command | Description |
|---|---|
dmidecode | Produces information a about BIOS, motherboard, etc. |
lscpu | CPU information |
lsmem | Breaks down memory allocation |
lspci | Lists PCI-connected devices |
lsusb | Lists connected USB devices |
lshw | Provides a detailed breakdown of components |
Hardware information
dmidecode
This command provides hardware information by pulling data from the DMI1 table. It includes information about the BIOS, Motherboards, CPU, and Memory of the computer.
We can also use dmidecode to get specific information about different parts of the computer:
Example
sudo dmidecode -t processorThe
-tflag specifies the type of data we want to retrieve. The output will be a detailed set of data, such as:# dmidecode 3.6 Getting SMBIOS data from sysfs. SMBIOS 3.3.0 present. Handle 0x0016, DMI type 4, 48 bytes Processor Information Socket Designation: AM4 Type: Central Processor Family: Zen Manufacturer: Advanced Micro Devices, Inc. ID: 12 0F A2 00 FF FB 8B 17 Signature: Family 25, Model 33, Stepping 2
Another example is to use dmidecode -t memory, which will return a list of Memory devices (often data about the RAM sticks installed, and other physical information):
➤ sudo dmidecode -t memory
# dmidecode 3.6
Getting SMBIOS data from sysfs.
SMBIOS 3.3.0 present.
Handle 0x0010, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 128 GB
Error Information Handle: 0x000F
Number Of Devices: 2
Handle 0x0018, DMI type 17, 92 bytes
Memory Device
Array Handle: 0x0010
Error Information Handle: 0x0017
Total Width: 64 bits
...lscpu
This provides a structured summary of our CPU. It will be more detailed that the general specifications returned by dmidecode; additionally, if we want information on each core we can use lscpu -e (-e stands for “extended”).
The extended command will gives us the following:
| CPU | NODE | SOCKET | CORE | L1d:L1i:L2:L3 | ONLINE |
|---|---|---|---|---|---|
| Logical processor number | Non-Uniform Memory Access node | Physical processor socket | Core number within the socket | CPU cache sizes | Whether the CPU is active or not |
Note
NUMA is an architecture designed to optimise memory access in multi-socket or multi-threaded configurations.
lsmem
Just like dmidecode can provide CPU data at the hardware level and lscpu can provided more specific information about the processor, lsmem is used to retrieve data about the allocation and structure of memory in the system, rather than the hardware components of memory:
➤ lsmem
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000000000000-0x00000000bfffffff 3G online yes 0-23
0x0000000100000000-0x000000083fffffff 29G online yes 32-263
Memory block size: 128M
Total online memory: 32G
Total offline memory: 0B| Column | Description |
|---|---|
| RANGE | Describes the memory range covered by each block of memory |
| SIZE | Hopw much memory is available |
| STATE | Whether the memory devices is online |
| REMOVABLE | Whether the device can be hot-swapped |
| BLOCK | The datablock that this device uses |
Hardware inventory
Hardware inventory commands help identify what hardware is installed from internal components of the computer, including stuff like GPUs, network cards, and USB drives, etc.
lspci
This command will show us what is connected to our motherboard through PCI. To view a more structured version we can use lspci -tv to understand how the devices are connected:
-[0000:00]-+-00.0 Advanced Micro Devices, Inc. [AMD] Starship/Matisse Root Complex
+-01.0 Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
+-01.1-[01]----00.0 Kingston Technology Company, Inc. A2000 NVMe SSD [SM2263EN]
+-01.2-[02-05]--+-00.0 Advanced Micro Devices, Inc. [AMD] 500 Series Chipset USB 3.1 XHCI Controller
| +-00.1 Advanced Micro Devices, Inc. [AMD] 500 Series Chipset SATA Controller
| \-00.2-[03-05]--+-00.0-[04]----00.0 Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller
| \-01.0-[05]----00.0 Intel Corporation Dual Band Wireless-AC 3168NGW [Stone Peak]The data in brackets [0000:00] represents the PCI bus being used (the root bus, in this case):
| Field | Description |
|---|---|
[0000:00] | The PCI bus (root in this case) |
+- symbols | Hierarchy - whether the device is connected to a specific controller |
00.0, 01.0, etc | The specific device address of the component |
| Text | What the device is and the manufacturer |
lsusb
This will give us a list of all the devices connected via USB, along with the manufacturer and device ID:
➤ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 26ce:01a2 ASRock LED Controller
Bus 001 Device 003: ID 8087:0aa7 Intel Corp. Wireless-AC 3168 Bluetooth
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubThe output from this command is similar to lspci, in that the first part shows us the specific device number and the bus it is connected to.
Example
In my computer I have a USB hub plugged in. As a result we can see that device 001 has multiple busses:
Bus 002 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 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The next column is the ID and vendor of the device. For example:
Bus 005 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver
Here the ID of the device includes a vendor ID before the colon identifying it as Logitech (which is always 046d) along with the Logitech-assigned product code (c52b in this case). This is not unlike MAC addresses and their classification.
lshw
While lspci and lsusb focus on specific devices types, lshw provides a full system report, including information provided by the other two commands. Often used to find extact information about the machine. The data can be trimmed with -short:
H/W path Device Class Description
============================================================
system Computer
/0 bus Motherboard
/0/0 memory 32GiB System memory
/0/1 processor AMD Ryzen 7 5700X 8-Core Processor
/0/100 bridge Starship/Matisse Root Complex
/0/100/1.1 bridge Starship/Matisse GPP Bridge
/0/100/1.1/0 /dev/nvme0 storage KINGSTON SA2000M81000G| Column | Description |
|---|---|
H/W path | Hardware hierarchy in the system |
Device column | Associated device file |
Class | Hardware type (based on dmidecode) |
Description | Human-readable component name |
Footnotes
-
This is known as the Desktop Management Interface table ↩