• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lshw Command Examples in Linux

by admin

lshw reports memory configuration, firmware versions, mainboard configuration, CPU version and speed, cache configuration, bus speed, hardware paths, attached devices, partitions, and filesystems. Try the lshw (Hardware Lister) command with no options, and store the output in a text file:

$ sudo lshw | tee hardware.txt
duchess
    description: Laptop
    product: Latitude E7240 (05CA)
    vendor: Dell Inc.
    version: 00
    serial: 456ABC1
    width: 64 bits
...

You’ll get several hundred lines of output that include firmware, drivers, capabilities, serial numbers, version numbers, and bus information. lshw will not probe any device attached via a wireless network interface, such as a wireless printer, or a smartphone attached via Bluetooth, but it will report wireless and Bluetooth interfaces.

You may prefer a summary in a hardware path tree view:

$ sudo lshw -short
Note: lshw has a graphical interface, which you open with sudo lshw -X. This is often a separate package, for example, lshw-gtk on Ubuntu and lshw-gui on openSUSE and Fedora.

lshw Command Examples

1. Launch the GUI:

# lshw -X

2. List all hardware in tabular format:

# lshw -short

3. List all disks and storage controllers in tabular format:

# lshw -class disk -class storage -short

4. Save all network interfaces to an HTML file:

# lshw -class network -html > interfaces.html

5. Run sudo lshw -short or sudo lshw -businfo to see a list of device classes, then name one or more device classes that you want to see:

# lshw -short -class bus -class cpu

Omit the -short option to see detailed information.

6. Format the long output as HTML, XML, or JSON, and store it in a file so you can use your favorite scripting hacks to parse the output:

# lshw -html -class bus -class cpu | tee lshw.html
# lshw -xml -class printer -class display -class input | tee lshw.xml
# lshw -json -class storage | tee lshw.json

Remove sensitive information with the -sanitize option, such as IP addresses and serial numbers, to make it safer to share with technical support:

# lshw -json -sanitize  -class bus -class cpu 

7. Display the memory section of a system’s hardware profile:

# lshw -class memory

Conclusion

If dmidecode is unavailable, you can also use lshw, a command for listing hardware. It makes use of the DMI table on a device. We have listed numerous examples of lshw command in this post which can be used for troubleshooting issues with Linux hardware.

Filed Under: Linux

Some more articles you might also be interested in …

  1. poweroff: command not found
  2. getsebool Command in Linux
  3. How to Disable Daylight Savings Time (DST), and Modify the Timezone on Linux
  4. Linux OS Service ‘winbind’
  5. btrfs inspect-internal Command Examples in Linux
  6. How to Control user access to Virtual Machine in RedHat Virtualization
  7. getent Command Examples in Linux
  8. How to load SELinux Module For Oracleasm
  9. How to Install dmg File on Mac from Command Line
  10. xrpd: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright