Linux lscpu Command Tutorial for Beginners (5 Examples)

The beauty of Linux demand line is based on the known fact that you can do almost anything using the command line tools. Even if it involves information that is fetching the device’s hardware elements. If that is everything want to do, and tend to be trying to find a command line method to this, you’re going to be pleased to understand you need to use the lshw demand for this.

In this guide, we are going to talk about this energy with a couple straightforward examples. Nevertheless before we do this, it is well worth mentioning that most examples in this specific article are tested on an Ubuntu 16.04 LTS device.

Linux lshw demand

As mentioned previously, the lshw demand allows you to fetch info that is hardware. Here’s the syntax of the command:

lshw [options]

And here’s how the man page explains the tool:

       lshw  is  a  ool that is small draw out detail by detail info on the equipment
       setup of device. It may report memory that is exact,
       firmware version, mainboard configuration, CPU version and speed, cache
       configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems  and
       on some PowerPC machines (PowerMac G4 is known to work).

       It  currently  supports  DMI  (x86 and IA-64 only), OpenFirmware device
       tree (PowerPC only), PCI/AGP, CPUID (x86), IDE/ATA/ATAPI, PCMCIA  (only
       tested on x86), SCSI and USB.

Following are some examples that are q&A-styled provides you with a much better concept on what this energy works.

Q1. Utilizing the lshw demand?

For standard use, all you’ve got doing would be to run the ‘lshw’ demand with no choices.


Note you need to perform the lshw demand with root privileges.

Following may be the production the demand produced on my system:

How to use the lshw command

Please keep in mind that this will be simply a part that is small of information produced in output.

Q2. How to have device tree output hardware that is showing?

For this, make use of the -short demand line choice.

lshw -short

here is the production the command that is above in my case:

How to have device tree output showing hardware paths

Q3. How make lshw fetch SCSI, USB, IDE and PCI device info?

This info can be fetched using the -businfo option of the command that is lshw

lshw -businfo

here is the production this demand stated in my situation:

How make lshw fetch SCSI, USB, IDE and PCI device info

Note: you can make use of -numeric choice if you like the device to additionally show numeric IDs (for PCI and USB products).

Q4. Making display that is lshw in HTML format.

There’s a command that is dedicated choice for this: -html. The above command produced on my system:

How to make lshw display information in HTML format

Q5 so you can use the tool in the following way:

lshw -html

Here’s the output. How to make display information in XML format?

Like HTML output, lshw command can also produce output in the XML format, and the command line option that facilitates this is -xml.

lshw -xml

Here’s a sample output in this ( that is format

How to make display information in XML format

Similarly, you need to use the -json demand line choice to show the product tree as a JSON item.

Q6. Making lshw perhaps not emit info that is sensitive output?

You’ll be glad to know lshw takes care of this requirement as well. Those who don’t want the tool to emit information that is potentially sensitive production may use the -sanitize choice. In this manner, it is possible to avoid lshw information that is emitting IP addresses, serial numbers, and more.

lshw -sanitize


As you’d agree, lshw is the not the command you’d require everyday. But it’s definitely a handy tool, you might want to access your system’s hardware details for you never know when. We talked about usage that is basic of device right here – for more information, visit the demand’s guy web page.


Please enter your comment!
Please enter your name here