• Get In Touch
July 17, 2016

View Hardware Information Using the Command Line on Linux

Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on.
View Plans

It is always good idea for every system administrator to view the hardware information of your Linux machine. This will help you to troubleshoot hardware related issues. There are many tools available to find the information about your hardware, some tools are web based and some are command line.

Requirements

Ubuntu 14.04 installed on your system.

View CPU Information

lscpu is a command line tool used to gathers cpu architecture information from sysfs and the /proc/cpuinfo file.

You can use the lscpu command as follows:

sudo lscpu

You should see the following output:

    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                4
    On-line CPU(s) list:   0-3
    Thread(s) per core:    1
    Core(s) per socket:    4
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 55
    Stepping:              8
    CPU MHz:               2159.000
    BogoMIPS:              4332.95
    Virtualization:        VT-x
    L1d cache:             24K
    L1i cache:             32K
    L2 cache:              1024K
    NUMA node0 CPU(s):     0-3

lshw

lshw also known as a hardware lister is used to gather detailed information on the hardware configuration of the machine. It provides information about multiple hardware like CPU, memory, disk, usb controller etc.

Let’s run the lshw utility:

sudo lshw -short

You should see the following output:

    H/W path       Device      Class       Description
    ==================================================
                               system      Inspiron 3551 (Inspiron 3551)
    /0                         bus         0CMF7W
    /0/0                       memory      64KiB BIOS
    /0/34                      processor   Intel(R) Pentium(R) CPU  N3540  @ 2.16GHz
    /0/34/32                   memory      224KiB L1 cache
    /0/34/33                   memory      2MiB L2 cache
    /0/1a                      memory      4GiB System Memory
    /0/1a/0                    memory      4GiB DIMM DDR3 1600 MHz (0.6 ns)
    /0/100                     bridge      ValleyView SSA-CUnit
    /0/100/2                   display     ValleyView Gen7
    /0/100/13                  storage     ValleyView 6-Port SATA AHCI Controller
    /0/100/14                  bus         ValleyView USB xHCI Host Controller
    /0/100/1a                  generic     ValleyView SEC
    /0/100/1b                  multimedia  ValleyView High Definition Audio Controller
    /0/100/1c                  bridge      ValleyView PCI Express Root Port
    /0/100/1c.2                bridge      ValleyView PCI Express Root Port
    /0/100/1c.2/0  wlan0       network     QCA9565 / AR9565 Wireless Network Adapter
    /0/100/1d                  bus         ValleyView USB Enhanced Host Controller
    /0/100/1f                  bridge      ValleyView Power Control Unit
    /0/100/1f.3                bus         ValleyView SMBus Controller
    /0/1           scsi0       storage     
    /0/1/0.0.0     /dev/sda    disk        500GB WDC WD5000LPVX-7
    /0/1/0.0.0/1   /dev/sda1   volume      499MiB Windows FAT volume
    /0/1/0.0.0/2   /dev/sda2   volume      39MiB BIOS Boot partition
    /0/1/0.0.0/3   /dev/sda3   volume      3071MiB Windows FAT volume
    /0/1/0.0.0/4   /dev/sda4   volume      93GiB EXT4 volume
    /0/1/0.0.0/5   /dev/sda5   volume      358GiB EXT4 volume
    /0/1/0.0.0/6   /dev/sda6   volume      10GiB Linux swap volume
    /0/2           scsi2       storage     
    /0/2/0.0.0     /dev/sdb    disk        xD/SD/M.S.
    /0/2/0.0.0/0   /dev/sdb    disk        
    /1                         power       DELL VN3N047
    /2             vethYWTR6Q  network     Ethernet interface

Gather USB Device Information

You can use the lsusb command line utility to find information about USB controller and all the devices that are connected to them.

Now, run lsusb command:

sudo lsusb

You should see the following output:

    Bus 001 Device 002: ID 8087:07e6 Intel Corp. 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 002 Device 003: ID 064e:9209 Suyin Corp. 
    Bus 002 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
    Bus 002 Device 006: ID 0cf3:e005 Atheros Communications, Inc. 
    Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

You can use the -v option to generate a detailed information about each USB device.

sudo lsusb -v | more

You should see the following output:

    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass            9 Hub
      bDeviceSubClass         0 Unused
      bDeviceProtocol         1 Single TT
      bMaxPacketSize0        64
      idVendor           0x8087 Intel Corp.
      idProduct          0x07e6 
      bcdDevice            0.14
      iManufacturer           0 
      iProduct                0 
      iSerial                 0 
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength           25
        bNumInterfaces          1
        bConfigurationValue     1
        iConfiguration          0 
        bmAttributes         0xe0
          Self Powered
          Remote Wakeup
        MaxPower                0mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
    --More--

Print PCI Device Information

Graphics cards, network adapters and usb ports are PCI devices. The lspci is a command line tool used to lists all the PCI buses and details about the devices connected to them like the VGA adapter, usb ports, SATA controller, graphics card, network adapter etc.

Run the following command to print information about PCI devices:

sudo lspci

You should see the following output:

    00:00.0 Host bridge: Intel Corporation ValleyView SSA-CUnit (rev 0e)
    00:02.0 VGA compatible controller: Intel Corporation ValleyView Gen7 (rev 0e)
    00:13.0 SATA controller: Intel Corporation ValleyView 6-Port SATA AHCI Controller (rev 0e)
    00:14.0 USB controller: Intel Corporation ValleyView USB xHCI Host Controller (rev 0e)
    00:1a.0 Encryption controller: Intel Corporation ValleyView SEC (rev 0e)
    00:1b.0 Audio device: Intel Corporation ValleyView High Definition Audio Controller (rev 0e)
    00:1c.0 PCI bridge: Intel Corporation ValleyView PCI Express Root Port (rev 0e)
    00:1c.2 PCI bridge: Intel Corporation ValleyView PCI Express Root Port (rev 0e)
    00:1d.0 USB controller: Intel Corporation ValleyView USB Enhanced Host Controller (rev 0e)
    00:1f.0 ISA bridge: Intel Corporation ValleyView Power Control Unit (rev 0e)
    00:1f.3 SMBus: Intel Corporation ValleyView SMBus Controller (rev 0e)
    03:00.0 Network controller: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (rev 01)

You can also filter out specific device information by running the following command:

sudo lspci -v | grep "VGA" -A 12

Output:

    00:02.0 VGA compatible controller: Intel Corporation ValleyView Gen7 (rev 0e) (prog-if 00 [VGA controller])
        Subsystem: Dell Device 06ab
        Flags: bus master, fast devsel, latency 0, IRQ 105
        Memory at d0000000 (32-bit, non-prefetchable) [size=4M]
        Memory at c0000000 (32-bit, prefetchable) [size=256M]
        I/O ports at f080 [size=8]
        Expansion ROM at  [disabled]
        Capabilities: 
        Kernel driver in use: i915

    00:13.0 SATA controller: Intel Corporation ValleyView 6-Port SATA AHCI Controller (rev 0e) (prog-if 01 [AHCI 1.0])
        Subsystem: Dell Device 06ab
        Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 104

You can also use the -t option to produce output in a tree format.

sudo lspci -t

Output:

    -[0000:00]-+-00.0
               +-02.0
               +-13.0
               +-14.0
               +-1a.0
               +-1b.0
               +-1c.0-[01]--
               +-1c.2-[03]----00.0
               +-1d.0
               +-1f.0
               -1f.3

Inxi Utility

inxi is a full featured CLI system information tool that fetches hardware information from multiple sources and commands on the system and gives you very good report that non-technical users can read easily.

By default, inxi is not installed in Ubuntu. You can install it by running the following command:

sudo apt-get install inxi

After installing inxi, Run the following command to get hardware information:

sudo inxi -Fx

You should see the following output:

    System:    Host: Vyom-PC Kernel: 3.13.0-32-generic x86_64 (64 bit, gcc: 4.8.2) Desktop: Gnome Distro: Zorin 9 trusty
    Machine:   System: Dell (portable) product: Inspiron 3551 version: A00
               Mobo: Dell model: 0CMF7W version: A00 Bios: Dell version: A00 date: 12/05/2014
    CPU:       Quad core Intel Pentium CPU N3540 (-MCP-) cache: 1024 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 17331.8 
               Clock Speeds: 1: 2159.00 MHz 2: 2159.00 MHz 3: 2159.00 MHz 4: 2159.00 MHz
    Graphics:  Card: Intel ValleyView Gen7 bus-ID: 00:02.0 
               X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz 
               GLX Renderer: Mesa DRI Intel Bay Trail GLX Version: 3.0 Mesa 10.1.3 Direct Rendering: Yes
    Audio:     Card: Intel ValleyView High Definition Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0 
               Sound: Advanced Linux Sound Architecture ver: k3.13.0-32-generic
    Network:   Card-1: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter driver: ath9k bus-ID: 03:00.0
               IF: wlan0 state: up mac: 4c:bb:58:9c:f5:55
               Card-2: Atheros usb-ID: 002-006
               IF: N/A state: N/A speed: N/A duplex: N/A mac: N/A
    Drives:    HDD Total Size: 500.1GB (13.6% used) 1: id: /dev/sda model: WDC_WD5000LPVX size: 500.1GB temp: 37C 
    Partition: ID: / size: 92G used: 33G (38%) fs: ext4 ID: swap-1 size: 11.32GB used: 0.00GB (0%) fs: swap 
    RAID:      No RAID devices detected - /proc/mdstat and md_mod kernel raid module present
    Sensors:   System Temperatures: cpu: 64.0C mobo: N/A 
               Fan Speeds (in rpm): cpu: N/A 
    Info:      Processes: 230 Uptime: 34 min Memory: 854.8/3836.4MB Runlevel: 2 Gcc sys: 4.8.2 
               Client: Shell (bash 4.3.11) inxi: 1.9.17 

View Partition Information

df also known as a “disk free” is a standard Unix command used to print the information about various partitions, their mount points and the used and available space on each.

You can run the df command as belows:

sudo df -H

You will see the following output.

    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda4        99G   36G   59G  38% /
    none            4.1k     0  4.1k   0% /sys/fs/cgroup
    udev            2.0G  4.1k  2.0G   1% /dev
    tmpfs           403M  1.4M  401M   1% /run
    none            5.3M     0  5.3M   0% /run/lock
    none            2.1G  611k  2.1G   1% /run/shm
    none            105M   33k  105M   1% /run/user
    /dev/sda1       521M   20M  501M   4% /boot/EFI
    /dev/sda5       379G   33G  327G  10% /Data

Extract Information about Hardware Components

dmidecode is another command line utility used to extracts hardware information by reading data from the DMI tables.

For example, if you want to display information about the processor, run:

sudo dmidecode -t processor-

You will see the following output:

    # dmidecode 2.12
    SMBIOS 2.8 present.

    Handle 0x0034, DMI type 4, 42 bytes
    Processor Information
        Socket Designation: SOCKET 0
        Type: Central Processor
        Family: Pentium
        Manufacturer: Intel
        ID: 78 06 03 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 55, Stepping 8
        Flags:
            FPU (Floating-point unit on-chip)
            VME (Virtual mode extension)
            DE (Debugging extension)
            PSE (Page size extension)
            TSC (Time stamp counter)
            MSR (Model specific registers)
            PAE (Physical address extension)
            MCE (Machine check exception)
            CX8 (CMPXCHG8 instruction supported)
            APIC (On-chip APIC hardware supported)
            SEP (Fast system call)
            MTRR (Memory type range registers)
            PGE (Page global enable)
            MCA (Machine check architecture)
            CMOV (Conditional move instruction supported)
            PAT (Page attribute table)
            PSE-36 (36-bit page size extension)
            CLFSH (CLFLUSH instruction supported)
            DS (Debug store)
            ACPI (ACPI supported)
            MMX (MMX technology supported)
            FXSR (FXSAVE and FXSTOR instructions supported)
            SSE (Streaming SIMD extensions)
            SSE2 (Streaming SIMD extensions 2)
            SS (Self-snoop)
            HTT (Multi-threading)
            TM (Thermal monitor supported)
            PBE (Pending break enabled)
        Version: Intel(R) Pentium(R) CPU N3540 @ 2.16GHz
        Voltage: 1.2 V
        External Clock: 83 MHz
        Max Speed: 2400 MHz
        Current Speed: 2160 MHz
        Status: Populated, Enabled
        Upgrade: Other
        L1 Cache Handle: 0x0032
        L2 Cache Handle: 0x0033
        L3 Cache Handle: Not Provided
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Core Count: 4
        Core Enabled: 4
        Thread Count: 4
        Characteristics:
            64-bit capable

To display information about the memory, run:

sudo dmidecode -t memory

You should see the following output:

    # dmidecode 2.12
    SMBIOS 2.8 present.

    Handle 0x001A, DMI type 16, 23 bytes
    Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 8 GB
        Error Information Handle: Not Provided
        Number Of Devices: 1

    Handle 0x001C, DMI type 17, 40 bytes
    Memory Device
        Array Handle: 0x001A
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 4096 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM_A
        Bank Locator: DIMM_A
        Type: DDR3
        Type Detail: Unknown
        Speed: 1600 MHz
        Manufacturer: Samsung         
        Serial Number: 208C0B41  
        Asset Tag: 03151300       
        Part Number: M471B5173EB0-YK0  
        Rank: 1
        Configured Clock Speed: 1333 MHz
        Minimum voltage:  1.350 V
        Maximum voltage:  1.500 V
        Configured voltage:  1.350 V

View SATA Device Information

hdparm is a command line tool used to view the information about sata devices connected to your system.

If you want to see the information of your SATA harddisk (sda), run the following command:

sudo hdparm -i /dev/sda

Output:
“` language-bash
/dev/sda:

 Model=WDC WD5000LPVX-75V0TT0, FwRev=01.01A01, SerialNo=WXV1EC4KN2N7
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=976773168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode
Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on.
View Plans

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]