Linux Commands

Linux lshw Command

The Linux Operating System’s beauty is that it allows users to do anything using a command-line tool. You can download applications, fetch information, or even whatever you want to intend can be done using the terminal.

To extract hardware information of the system, the Linux system introduced the command-line utility “lshw.”

The “lshw” command is a small tool to display a complete picture of hardware configuration. While using this command in a terminal, you will get a print of CPU version, memory configuration, cache information, bus speed, and other PowerPC machines running on the backend.

It is a simple command-line tool, but to display complete information, you must be a super-user; otherwise, it will print partial information.

lshw Command Syntax:

Syntax of lshw command is:

lshw [options]

lshw Command:

Simply run the “lshw” command to get the complete configuration picture in the terminal with root privileges.

$ lshwl.m,

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image5 final.png

Lshw Format:

lshw command formats can be:

“-short”:

The “short” command-line option is used to display hardware paths in a compact format.

$ lshw -short

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image7 final.png

“-html”:

To print hardware information in html format, use the “-html” command-line in the terminal.

$ sudo lshw –html

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image6 final.png

“-xml”:

To print hardware configuration details in xml format, type “-xml” in the terminal.

$ sudo lshw –xml

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image9 final.png

lshw Command Options:

lshw command tool supports multiple options. Every function has its unique functionality.

Enable:

It is used when you want to enable different parameters of the system. For example, I want to allow the “speed” parameter; the command would be:

$ sudo lshw -enable spd

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image8 final.png

Disable:

To disable any parameter’s functionality, use the “-disable” option with the parameter name.

For example, I enabled “speed” in the above section, So, to disable it:

$ sudo lshw -disable spd

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image2 final.png

Quiet:

The “quite” option is used to hide display status.

$ sudo lshw -quiet

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image1 final.png

Sanitize:

The “sanitize” option is used when users don’t want to display sensitive information.

When we use the “sanitize” option with the “lshw” command, it will print hardware information without any sensitive data.

$ sudo lshw -sanitize

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image4 finl.png

Help:

To get any help related to the “lshw” command, type “–help” in the terminal, and it will display format options, available command options, and other helping material as well.

$ lshw –help

D:\Warda\march\17\Linux lshw Command Tutorial\Linux lshw Command Tutorial\images\image3 final.png

Conclusion:

The “lshw” is a command-line tool to extract hardware configuration. We don’t need to install a specific tool or application for this purpose; Linux introduced a small built-in utility to configure hardware data like memory information, cache data, busses, ports, CPU configuration, etc. This guide has seen multiple formats that can display data and “lshw” options to perform different functions.

About the author

Syeda Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.