lshw command in Linux with Examples

23 May, 2019
lshw(list hardware) is a small Linux/Unix tool which is used to generate the detailed information of the system’s hardware configuration from various files in the /proc directory. lshw can also report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache memory configuration, bus speed, etc on DMI-capable x86 or IA-64(Itanium family of 64 microprocessors) system and some PowerPC machine. This command needs root permission to show full information else partial information will be displayed.
Syntax:
lshw [-format] [-options ...]
Where format can be:
-html: Output hardware tree as HTML.
-xml: Output hardware tree as XML.
-short: Output hardware paths.
-businfo: Output bus information.
Example 1: To display full hardware information.
Input:
Output:
Example 2: Lists hardware in a compact format.
Input:
Output:
Options:
-class CLASS: This option is used when we only want lshw command to show a certain class of hardware.Example 1: To lists all disks and storage controllers in the system.Example 2: To lists all network interfaces in HTML file say geeksforgeeks.html.Input:A file namely geeksforgeeks.html will be created in the home directory as soon as we execute the command. The image shown below is the output displayed in the created html file.Output:
Example 1: To lists all disks and storage controllers in the system.
Example 2: To lists all network interfaces in HTML file say geeksforgeeks.html.
Input:
A file namely geeksforgeeks.html will be created in the home directory as soon as we execute the command. The image shown below is the output displayed in the created html file.
Output:
-disable TEST, -enable TEST : This option is used to enable or disable a test like pci, isapnp, cpuid, usb, network, dmi, device-tree, cpuinfo, spd, etc.Example: To enable pci.Input:Output:
Example: To enable pci.
Input:
Output:
-quiet: This option is used when the user don’t want lshw to display status.
-sanitize: This option is used to sanitize output i.e. when we don’t want sensitive information like serial numbers, etc to be displayed.Example: To check hardware information without the serial number or any other sensitive information.Input:Output:You can see in the fourth line of the above output, the serial number is not displayed instead it shows [REMOVED].
Example: To check hardware information without the serial number or any other sensitive information.
Input:
Output:
You can see in the fourth line of the above output, the serial number is not displayed instead it shows [REMOVED].
-numeric: This option is used to when the user also want lshw to display numeric IDs (for PCI, USB, etc.)Example: To check numeric IDs of class disk.
Example: To check numeric IDs of class disk.
-version: Displays the version of lshw and exits.
–help: Display help related information, available command line options and exit.
linux-command
Linux-misc-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
Introduction to Linux Operating System
Array Basics in Shell Scripting | Set 1
nohup Command in Linux with Examples
chmod command in Linux with examples
mv command in Linux with examples
Basic Operators in Shell Scripting