Learn how to check the hardware specifications of your ubuntu 16.04 based server using the LSHW CLI tool.

How to check system specifications in Ubuntu Server 16.04 with the CLI

As an administrator of servers, you will need to provide reports and check as well if the providen server met the required conditions to run some applications. Unlike operative systems with graphical interfaces, in Ubuntu there's no pre-installed tool to know the specifications of the computer that is running the OS, however there's an awesome tool named lswh that allows you to retrieve a lot of information about the hardware of the server with pretty short commands.

In this article, we'll teach you how to use lshw to know more about the hardware of your server in Ubuntu 16.04.

1. Install lshw (HardWare LiSter for Linux)

lshw is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or EFI (IA-64) systems and on some ARM and PowerPC machines (PowerMac G4 is known to work). The information can be output in plain text, XML or HTML. It currently supports DMI (x86 and EFI only), OpenFirmware device tree (PowerPC only), PCI/AGP, ISA PnP (x86), CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), USB and SCSI.

To install this package on your ubuntu system, run the following command:

sudo apt-get install lshw

After the installation you will be able to list all the specifications of your server eitherin HTML format or plain text. For more information about this project, visit the official repository here.

2. Generate inline short specs list

The prefered way for almost every user of this tool, is a short list with the description and values of the components of our interest, namely the processor, RAM, storage capacity and network information. lshw allows you to see such description with the following command:

sudo lshw -short

That will generate an output similar to:

H/W path        Device     Class       Description
==================================================
                           system      VirtualBox
/0                         bus         VirtualBox
/0/0                       memory      128KiB BIOS
/0/1                       memory      1999MiB System memory
/0/2                       processor   Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
/0/100                     bridge      440FX - 82441FX PMC [Natoma]
/0/100/1                   bridge      82371SB PIIX3 ISA [Natoma/Triton II]
/0/100/1.1                 storage     82371AB/EB/MB PIIX4 IDE
/0/100/2                   display     VirtualBox Graphics Adapter
/0/100/3        eth0       network     82540EM Gigabit Ethernet Controller
/0/100/4                   generic     VirtualBox Guest Service
/0/100/5                   multimedia  82801AA AC'97 Audio Controller
/0/100/7                   bridge      82371AB/EB/MB PIIX4 ACPI
/0/100/8        eth1       network     82540EM Gigabit Ethernet Controller
/0/100/d                   storage     82801HM/HEM (ICH8M/ICH8M-E) SATA Controll
/0/3            scsi2      storage
/0/3/0.0.0      /dev/sda   disk        68GB VBOX HARDDISK
/0/3/0.0.0/1    /dev/sda1  volume      487MiB Linux filesystem partition
/0/3/0.0.0/2    /dev/sda2  volume      63GiB Extended partition
/0/3/0.0.0/2/5  /dev/sda5  volume      63GiB Linux LVM Physical Volume partition

3. Generate general specs list as HTML

If for you isn't enough a short description on the CLI, lshw is able to generate an HTML based report with the a detailed description of all the components of your ubuntu based server, just set the output format to html and pipe its content into a HTML file:

sudo lshw -html > server_specs.html

The content of the server_specs.html file will then look something like:

Ubunto Detailed Specs on HTML

This option is pretty useful when you have to provide a detailed description for someone that doesn't have access to the server. You can simply print the file or send it to someone else.

4. Generate specific component description

If you want detailed description about a specific component of your system, simply filter the output specifyng the component that you want with the -c argument:

sudo lshw -C [component name]

For example:

Network

To display information about the network interface use:

sudo lshw -C network

This will generate an output similar to:

*-network:0
    description: Ethernet interface
    product: 82540EM Gigabit Ethernet Controller
    vendor: Intel Corporation
    physical id: 3
    bus info: pci@0000:00:03.0
    logical name: eth0
    version: 02
    serial: 08:00:27:e8:bf:1b
    size: 1Gbit/s
    capacity: 1Gbit/s
    width: 32 bits
    clock: 66MHz
    capabilities: pm pcix bus_master cap_list ethernet physical tp 10bt 10bt-                                          fd 100bt 100bt-fd 1000bt-fd autonegotiation
    configuration: autonegotiation=on broadcast=yes driver=e1000 driverversio                                          n=7.3.21-k8-NAPI duplex=full ip=10.0.2.15 latency=64 link=yes mingnt=255 multica                                          st=yes port=twisted pair speed=1Gbit/s
    resources: irq:19 memory:f0000000-f001ffff ioport:d010(size=8)
*-network:1
    description: Ethernet interface
    product: 82540EM Gigabit Ethernet Controller
    vendor: Intel Corporation
    physical id: 8
    bus info: pci@0000:00:08.0
    logical name: eth1
    version: 02
    serial: 08:00:27:69:a2:01
    size: 1Gbit/s
    capacity: 1Gbit/s
    width: 32 bits
    clock: 66MHz
    capabilities: pm pcix bus_master cap_list ethernet physical tp 10bt 10bt-                                          fd 100bt 100bt-fd 1000bt-fd autonegotiation
    configuration: autonegotiation=on broadcast=yes driver=e1000 driverversio                                          n=7.3.21-k8-NAPI duplex=full ip=192.168.33.10 latency=64 link=yes mingnt=255 mul                                          ticast=yes port=twisted pair speed=1Gbit/s
    resources: irq:16 memory:f0820000-f083ffff ioport:d240(size=8)

Storage (partitions)

To display information about the storage capacity and partitions in your system use:

sudo lshw -C volume

This will generate an output similar to:

*-volume:0
    description: Linux filesystem partition
    vendor: Linux
    physical id: 1
    bus info: scsi@2:0.0.0,1
    logical name: /dev/sda1
    logical name: /boot
    version: 1.0
    serial: 9ff6ec2f-4052-4861-a546-f31e7a95c11b
    size: 487MiB
    capacity: 487MiB
    capabilities: primary bootable extended_attributes large_files ext2 initialized
    configuration: filesystem=ext2 lastmountpoint=/boot modified=2018-07-01 19:24:44 mount.fstype=ext2 mount.options=rw,relatime,block_validity,barrier,user_xattr,acl mounted=2018-07-01 19:24:44 state=mounted
*-volume:1
    description: Extended partition
    physical id: 2
    bus info: scsi@2:0.0.0,2
    logical name: /dev/sda2
    size: 63GiB
    capacity: 63GiB
    capabilities: primary extended partitioned partitioned:extended
    *-logicalvolume
        description: Linux LVM Physical Volume partition
        physical id: 5
        logical name: /dev/sda5
        serial: eSLg7t-nBsZ-fJT4-gDq4-s70Z-1Cg5-rIwDUX
        size: 63GiB
        capacity: 63GiB
        capabilities: multi lvm2

Processor

To display information about the processor use:

sudo lshw -C processor

This will generate an output similar to:

*-cpu
    product: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
    vendor: Intel Corp.
    physical id: 2
    bus info: cpu@0
    width: 64 bits
    capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp x86-64 constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx rdrand hypervisor lahf_lm fsgsbase

Sound

To display information about the sound card use:

sudo lshw -C sound

This will generate an output similar to:

*-multimedia
    description: Multimedia audio controller
    product: 82801AA AC'97 Audio Controller
    vendor: Intel Corporation
    physical id: 5
    bus info: pci@0000:00:05.0
    version: 01
    width: 32 bits
    clock: 33MHz
    capabilities: bus_master
    configuration: driver=snd_intel8x0 latency=64
    resources: irq:21 ioport:d100(size=256) ioport:d200(size=64)

Memory

To display information about the RAM memory use:

sudo lshw -C memory

This will generate an output similar to:

*-firmware
    description: BIOS
    vendor: innotek GmbH
    physical id: 0
    version: VirtualBox
    date: 12/01/2006
    size: 128KiB
    capabilities: isa pci cdboot bootselect int9keyboard int10video acpi
*-memory
    description: System memory
    physical id: 1
    size: 1999MiB

As mentioned at the beginning of the article, lshw is a pretty nice utility with a lot of options, so you will be able to learn more about it in the man page for this tool as well.

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors