Learning the common Linux-based commands is essential to get the best of the benefits that this OS brings. Though, putting an accent on some more specific commands will improve your work and will provide you and even more freedom and opportunities with your Linux job. So speaking of all of these, we have decided to give you some information and tips for one specific, but very important and interesting Linux-based command – the lshw command. Find out what it is and how to use it right away with our simple, brief and very beneficial tutorial.
The lshw command is, as a matter of fact, a small, but significant tool that gives you a chance to extract detailed info on your hardware configuration of the machine you use with Linux OS (Ubuntu, Debian or any other distro). Mainly, the command might also report physical memory configuration, firmware version, as well as CPU version and speed, several cache configuration possibilities, mainboard configuration and the bus speed on the DMI-capable x86, as well as on IA-64 systems. If you wonder abbreviation lshw comes from Hardware Lister put in opposite order.
In other words, the lshw Linux-based command offers you detailed of all the hardware files that are stored and used on your personal PC. Meanwhile, these details run the gamut of processors, memory, onboard sound, as well as the video chipsets and many others. The nifty command arranges the utility, which processes the detailed reports, when it comes to several different hardware components in a Linux-based system. The particular way the lshw does is by reading the different files in directory. But let`s begin with the lshw command usage tutorial to make it much clearer for you. Another article in this series is How To Check Ubuntu Version written a couple of months ago.
Advertisements
How to install the lshw?
If you are either an Ubuntu, Fedora, or Debian user, then, you can get the lshw command from your default repositories. If you are using Debian or any Debian derivative such as Ubuntu or Linux Mint just type.
howopensource@esprimo:~$ sudo apt-get install lshw
If you are using Fedora or Cent Linux use yum.
howopensource@esprimo:~$ sudo yum install lshw
Lshw is a command line tool, but if you prefer to use GUI then you can install lshw-gtk which is GTK based front end to lshw.
Advertisements
howopensource@esprimo:~$ sudo apt-get install lshw-gtk
To run GUI just type lshw-gtk. Remember that you need to run GUI with root privileges, so don’t forget to use sudo.
howopensource@esprimo:~$ sudo lshw-gtk
How to use lshw command to detect hardware?
If you want your lshw command to detect and report most of the information on your system, it must run as root. Another alternative is to use the sudo option.
The lshw groups the different components in the hardware into several categories that are named classes. Such classes are the following components – the memory, display, processor, network and many others like the storage component, for instance.
How to find the entire hardware info?
If you decide to run the lshw command without inputting any particular option, it will process the entire information and will get you an overall report about all of the detected hardware components. Thus, the entire generation will be full of many technical details.
howopensource@esprimo:~$ sudo lshw esprimo description: Desktop Computer product: ESPRIMO E700 (S26361-Kxxx-Vyyy) vendor: FUJITSU version: C$EKW1 serial: YLCU045456 width: 64 bits capabilities: smbios-2.7 dmi-2.7 vsyscall32 configuration: administrator_password=disabled boot=normal chassis=desktop power-on_password=disabled sku=S26361-Kxxx-Vyyy uuid=46728E13-B16F-11E1-BDB7-4F07B3193098 *-core description: Motherboard product: D3061-A1 vendor: FUJITSU physical id: 0 version: S26361-D3061-A1 serial: B2102FC6 .........................................
How to present the hardware information in brief?
To present the information in brief, you will need to run the command lshw with the -short option. Thus, it will generate a report about particular hardware components, which will show you faster the main look of your hardware profile, as well as of the system.
This output can be simply interpreted. Thus, the result is the following: the device is with a processor Intel, as well as with 1 network adapter, few USB ports, 4RAM slots, 300 GB hard drive with one main partition. Note that the third column of the above codes shows the name of the class. This is due to the fact that the Lshw command is able to show the information only about a single class, if you input the -class feature.
howopensource@esprimo:~$ sudo lshw -short H/W path Device Class Description ===================================================== system ESPRIMO E700 (S26361-Kxxx-Vyyy) /0 bus D3061-A1 /0/0 memory 64KiB BIOS /0/4 memory 128KiB L1 cache /0/5 memory 512KiB L2 cache /0/6 memory 3MiB L3 cache /0/2c memory 4GiB System Memory /0/2c/0 memory DIMM Synchronous [empty] /0/2c/1 memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0 /0/2c/2 memory DIMM Synchronous [empty] /0/2c/3 memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0 /0/40 processor Intel(R) Core(TM) i3-2120 CPU @ 3.30GH /0/100 bridge 2nd Generation Core Processor Family D /0/100/2 display 2nd Generation Core Processor Family I /0/100/16 communication 6 Series/C200 Series Chipset Family ME /0/100/19 eth0 network 82579V Gigabit Network Connection /0/100/1a bus 6 Series/C200 Series Chipset Family US /0/100/1b multimedia 6 Series/C200 Series Chipset Family Hi /0/100/1d bus 6 Series/C200 Series Chipset Family US /0/100/1e bridge 82801 PCI Bridge /0/100/1f bridge Q65 Express Chipset Family LPC Control /0/100/1f.2 storage 6 Series/C200 Series Chipset Family 4 /0/100/1f.3 bus 6 Series/C200 Series Chipset Family SM /0/100/1f.5 storage 6 Series/C200 Series Chipset Family 2 /0/1 scsi0 storage /0/1/0.0.0 /dev/sda disk 320GB WDC WD3200AAKX-0 /0/1/0.0.0/1 /dev/sda1 volume 294GiB EXT4 volume /0/1/0.0.0/2 /dev/sda2 volume 3966MiB Extended partition /0/1/0.0.0/2/5 /dev/sda5 volume 3966MiB Linux swap / Solaris partition howopensource@esprimo:~$
How to present only the information about the memory?
Check out how to present the information about the memory by using of the memory class parameter.
howopensource@esprimo:~$ sudo lshw -short -class memory H/W path Device Class Description ===================================================== /0/0 memory 64KiB BIOS /0/4 memory 128KiB L1 cache /0/5 memory 512KiB L2 cache /0/6 memory 3MiB L3 cache /0/2c memory 4GiB System Memory /0/2c/0 memory DIMM Synchronous [empty] /0/2c/1 memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns) /0/2c/2 memory DIMM Synchronous [empty] /0/2c/3 memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns) howopensource@esprimo:~$
How to find the information about the processor?
The lshw command will present the information about the cpu with the class named processor. It is highly recommended to avoid using the parameter short in order to get all of the details about the processor. Note that lshw command actually does not show the numbers of cores or the available processing units very precisely. Looking above, you will see that the system had 4-core processor with 4 main units. Though, there is one other Linux command – the lscpu – which can, as a matter of fact, show you more precise information as to the cpu.
howopensource@esprimo:~$ sudo lshw -class processor *-cpu description: CPU product: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz vendor: Intel Corp. physical id: 40 bus info: cpu@0 version: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz slot: SOCKET 0 size: 3239MHz capacity: 3800MHz width: 64 bits clock: 100MHz capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid cpufreq configuration: cores=2 enabledcores=2 threads=4 howopensource@esprimo:~$
How to determine the disk drives?
To present the disk drives, use the disk class. You can also show the info about the components, as well as about the controllers, when you specify the storage and the volume class together with the main disk class. In this way, you will get presented some better and more precise information about your system storage.
howopensource@esprimo:~$ sudo lshw -short -class disk H/W path Device Class Description ===================================================== /0/1/0.0.0 /dev/sda disk 320GB WDC WD3200AAKX-0 howopensource@esprimo:~$ howopensource@esprimo:~$ sudo lshw -short -class disk -class storage -class volume H/W path Device Class Description ===================================================== /0/100/1f.2 storage 6 Series/C200 Series Chipset Family 4 port SATA IDE Controller /0/100/1f.5 storage 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller /0/1 scsi0 storage /0/1/0.0.0 /dev/sda disk 320GB WDC WD3200AAKX-0 /0/1/0.0.0/1 /dev/sda1 volume 294GiB EXT4 volume /0/1/0.0.0/2 /dev/sda2 volume 3966MiB Extended partition /0/1/0.0.0/2/5 /dev/sda5 volume 3966MiB Linux swap / Solaris partition howopensource@esprimo:~$
How to find the information about the Network adapter?
If you want to get and show the information about the network adapter or interface, then, you need to apply the network class. Here, it is recommended to avoid the short feature, as well, in order to receive the full and detailed information about the network adapter or interface. Keep in mind that estimation of the serial field is actually the MAC address. Also, the configuration field shows that the autonegotiation is on and 100Mbit/s is the present speed of the operating system. You are able to change the configurations by using the ethtool command.
howopensource@esprimo:~$ sudo lshw -class network *-network description: Ethernet interface product: 82579V Gigabit Network Connection vendor: Intel Corporation physical id: 19 bus info: pci@0000:00:19.0 logical name: eth0 version: 04 serial: 00:12:45:d4:d6:e5 size: 100Mbit/s capacity: 1Gbit/s width: 32 bits clock: 33MHz capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=2.3.2-k duplex=full firmware=0.13-4 ip=192.168.1.3 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s resources: irq:40 memory:fe400000-fe41ffff memory:fe427000-fe427fff ioport:f060(size=32)
How to find the details of the address by using the businfo?
You can apply the businfo feature and the lshw will generate the address details of the following: pci, scsi, ide and usb devices. Here, the output is almost the same as the “short” feature – see the 1st column that can be replaced with the businfo.
howopensource@esprimo:~$ sudo lshw -businfo Bus info Device Class Description ======================================================= system ESPRIMO E700 (S26361-Kxxx-Vyyy) bus D3061-A1 memory 64KiB BIOS memory 128KiB L1 cache memory 512KiB L2 cache memory 3MiB L3 cache memory 4GiB System Memory memory DIMM Synchronous [empty] memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns) memory DIMM Synchronous [empty] memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns) cpu@0 processor Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz pci@0000:00:00.0 bridge 2nd Generation Core Processor Family DRAM Controller pci@0000:00:02.0 display 2nd Generation Core Processor Family Integrated Graphics Controller pci@0000:00:16.0 communication 6 Series/C200 Series Chipset Family MEI Controller #1 pci@0000:00:19.0 eth0 network 82579V Gigabit Network Connection pci@0000:00:1a.0 bus 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 pci@0000:00:1b.0 multimedia 6 Series/C200 Series Chipset Family High Definition Audio Controller pci@0000:00:1d.0 bus 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 pci@0000:00:1e.0 bridge 82801 PCI Bridge pci@0000:00:1f.0 bridge Q65 Express Chipset Family LPC Controller pci@0000:00:1f.2 storage 6 Series/C200 Series Chipset Family 4 port SATA IDE Controller pci@0000:00:1f.3 bus 6 Series/C200 Series Chipset Family SMBus Controller pci@0000:00:1f.5 storage 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller scsi0 storage scsi@0:0.0.0 /dev/sda disk 320GB WDC WD3200AAKX-0 scsi@0:0.0.0,1 /dev/sda1 volume 294GiB EXT4 volume scsi@0:0.0.0,2 /dev/sda2 volume 3966MiB Extended partition /dev/sda5 volume 3966MiB Linux swap / Solaris partition howopensource@esprimo:~$
As a conclusion we must tell you that all of the illustrations we have showed you are almost all of the lshw command options. You can also take the benefit of the lshw-gtk, which is a GUI that shows reports of the same info, but in a more minimal interface. Also, you can find many other GUI tools in the web that will give you the same opportunities for a more organized manner of the shown reports.