Getting Complete Hardware Specification On Linux From Terminal Using Facter And Dmidecode

There are many built-in and plenty of external GUI tools available to determine the hardware specifications in your system. But, none of them won’t help if you’re managing systems those are only having Command line mode.

In this tutorial, let us explore the following two useful tools that can be used to display the comprehensive details of your system specifications via Terminal.

  1. Facter
  2. Dmidecode

These tools will display the complete system’s details such as,

  • Kernel version;
  • Operating system name;
  • Hostname;
  • Network interface card details;
  • Processor details;
  • File systems details;
  • Architecture;
  • Bios version and Manufacturer;
  • Vendor Family;
  • CPU MHz;
  • Number of Processors;
  • Hdd size;
  • RAM size;
  • Swap memory details;
  • IP addresses;
  • MAC addresses;
  • SSH keys;
  • Timezone;
  • Uptime;
  • System serial number;
  • Whether your system is Virtual(VPS) or Physical;
  • and many.

1. Facter

As you may know, Facter is a lightweight, command line utility, used to display the system specification from Terminal. This tool is developed by Luke Kanies, and is licensed under Apache 2.0. Facter was originally created for Puppet automation tool, but it is also available as independent command in almost all modern Linux operating systems.

Installation

To install Facter, enter the following command from your Terminal.

On Deb based systems:

sudo apt-get install facter

On RPM based systems:

On RHEL based systems, enable EPEL repository first.

Then, install it as shown below.

yum install facter

Usage

Facter usage is pretty simple and straight forward. Just, run the following command from your Terminal to display the complete hardware details of your system.

sudo facter

Sample Output:

architecture => amd64
bios_release_date => 05/23/2008
bios_vendor => Hewlett-Packard
bios_version => 68MVU Ver. F.00
blockdevice_sda_model => Hitachi HTS54323
blockdevice_sda_size => 320072933376
blockdevice_sda_vendor => ATA
blockdevice_sr0_model => DVDRAM GSA-T40L
blockdevice_sr0_size => 1073741312
blockdevice_sr0_vendor => HL-DT-ST
blockdevices => sda,sr0
boardmanufacturer => Hewlett-Packard
boardproductname => 3618
boardserialnumber => Not Specified
facterversion => 1.7.5
filesystems => ext2,ext3,ext4,vfat
hardwareisa => x86_64
hardwaremodel => x86_64
hostname => sk
id => root
interfaces => eth0,lo,wlan0
ipaddress => 192.168.1.200
ipaddress_lo => 127.0.0.1
ipaddress_wlan0 => 192.168.1.200
is_virtual => false
kernel => Linux
kernelmajversion => 3.13
kernelrelease => 3.13.0-37-generic
kernelversion => 3.13.0
lsbdistcodename => trusty
lsbdistdescription => Ubuntu 14.04.1 LTS
lsbdistid => Ubuntu
lsbdistrelease => 14.04
lsbmajdistrelease => 14
macaddress => 00:xx:xx:xx:xx:xx
macaddress_eth0 => 00:xx:xx:xx:xx:xx
macaddress_wlan0 => 00:xx:xx:xx:xx:xx1
manufacturer => Hewlett-Packard
memoryfree => 2.70 GB
memoryfree_mb => 2764.18
memorysize => 3.85 GB
memorysize_mb => 3945.11
memorytotal => 3.85 GB
mtu_eth0 => 1500
mtu_lo => 65536
mtu_wlan0 => 1500
netmask => 255.255.255.0
netmask_lo => 255.0.0.0
netmask_wlan0 => 255.255.255.0
network_lo => 127.0.0.0
network_wlan0 => 192.168.1.0
operatingsystem => Ubuntu
operatingsystemrelease => 14.04
osfamily => Debian
path => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
physicalprocessorcount => 1
processor0 => Intel(R) Core(TM)2 Duo CPU     T5470  @ 1.60GHz
processor1 => Intel(R) Core(TM)2 Duo CPU     T5470  @ 1.60GHz
processorcount => 2
productname => HP 550
ps => ps -ef
rubysitedir => /usr/local/lib/site_ruby/1.9.1
rubyversion => 1.9.3
selinux => false
serialnumber => CNUXXXXXXX
sshdsakey => AAAAB3NzaC1kb+HX9tmzpHagXHAbq5o0V/4dPhoop06zZ31Iy9m3yXp6unGIct6bguP+vD21BxEdt1HzEzMSKM1zBchZAAAAFQCSGJBo2fYjKP28qUAEPCq9EMImeQAAAIArpZNiYTvW2bgx6ttUp552uUqqXMPiTRt8+KyTaqcAReJljeN5YnTAmNx/QGZGt5pgxboBdqaOMzrdOLwa3TguZ8l6FNelPcXb0REHScxd/5/Afs2mtWquShrCNJfeH22VS24CHgmJ83VpNs/3DQwpm1Cq2NLvEQNbxvYy1H1eEwAAAIAbdXJa8ktPbKM9eDaXuIIUQ9ODK+myGsUB6ygR+PHxi6g3BkB79XlPNDpJcz2ngUCvV/bJn3n4RjHEXcxSL0MeHDYqVdWw1KzdDNwJHO2YTmBpkulB6boLOqudlmBL4t6RXqEz2LDwGJQ5Msdn1TZQ8ccmsOfBlXLti5QmhGXyoA==
sshecdsakey => AAAAE2VjZHxkJs6GnCwEd901dWzZe/kmvOK+pC4pFJvNCNwdYMvBCSrk7bnLEX5DQ=
sshfp_dsa => SSHFP 2 1 b612213a1efe1d62bb9e5
SSHFP 2 2 0677a4140a65b0d2f8c97fb1
sshfp_ecdsa => SSHFP 3 1 3ef1afc0b3bbb70b
SSHFP 3 2 39dd2bde0989cb8b88e68466061dcf37d
sshfp_rsa => SSHFP 1 1 9a0686541717d
SSHFP 1 2 8ade121c606de6601d7706c603491
sshrsakey => AAAAB3NzaC1yTp0Kl2TXbQLnfS8gMn3LgfJ6+03ELxWw7sPxmLXz1cSrsurFRoRx1RzQ9DdzCg3iP+rv0VKkFlIZP2mabwnZWEoS6Ln3ykixq5Y488s+EwLLwEk8ROiOHTwPATiQx53r9nDgWeSeD2hDV/mN02Zep4Ci3GwkxK2Lf+iFHABMnEqvgSzLspkJTXhtIuNLEoczrz7GbJpy1PgxzIDYYJIfTMJ
swapfree => 3.99 GB
swapfree_mb => 4086.00
swapsize => 3.99 GB
swapsize_mb => 4086.00
timezone => IST
type => Notebook
uniqueid => 00XXXXXX
uptime => 5:29 hours
uptime_days => 0
uptime_hours => 5
uptime_seconds => 19770
uuid => E3XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX
virtual => physical

As you see in the above result, Facter displays the complete details of my Ubuntu system such as Operating name, IP address, Mac Address, Kernel version, Hdd size, RAM size, SSH keys etc. What else do you need? Just get rid of the daunting GUI tools, and use this very sleek and lightweight tool.

2. Dmidecode

Dmidecode is yet another command line tool to display the comprehensive details of your system specification. Unlike Facter, this tool comes with preinstalled by default on most Linux operating system.

In case if it not installed, the following command will install it.

On DEB based systems;

sudo apt-get install dmidecode

On RPM based systems:

yum install dmidecode

Usage

Dmidecode usage is as same as Facter tool. Enter the following command to retrieve your complete hardware specifications.

sudo dmidecode

Sample Output:

# dmidecode 2.12
SMBIOS 2.4 present.
25 structures occupying 1236 bytes.
Table at 0x000F25F6.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: Hewlett-Packard
    Version: 68MVU Ver. F.00
    Release Date: 05/23/2008
    Address: 0xE0000
    Runtime Size: 128 kB
    ROM Size: 1024 kB
    Characteristics:
        PCI is supported
        PC Card (PCMCIA) is supported
        PNP is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        Boot from CD is supported
        Selectable boot is supported
        EDD is supported
        3.5"/720 kB floppy services are supported (int 13h)
        Print screen service is supported (int 5h)
        8042 keyboard services are supported (int 9h)
        Serial services are supported (int 14h)
        Printer services are supported (int 17h)
        ACPI is supported
        USB legacy is supported
        LS-120 boot is supported
        Smart battery is supported
        BIOS boot specification is supported
        Function key-initiated network boot is supported
        Targeted content distribution is supported
    BIOS Revision: 15.0
    Firmware Revision: 18.0

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: Hewlett-Packard
    Product Name: HP 550
.
.
.
.
Handle 0x0085, DMI type 133, 34 bytes
OEM-specific Type
    Header and Data:
        85 22 85 00 01 00 00 00 00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00
        00 00
    Strings:
                        
        No battery        

Handle 0x0086, DMI type 134, 34 bytes
OEM-specific Type
    Header and Data:
        86 22 86 00 01 00 00 00 00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00
        00 00
    Strings:
                                                  
Handle 0x0013, DMI type 144, 26 bytes
OEM-specific Type
    Header and Data:
        90 1A 13 00 FF FF FF FF FF FF FF FF FF FF FF FF
        FF FF FF FF FF FF FF FF 00 00

Handle 0x0014, DMI type 127, 4 bytes
End Of Table

Also, you can narrow down your results only for particular category.

View System details only:

sudo dmidecode -t system

Sample Output:

# dmidecode 2.12
SMBIOS 2.4 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: Hewlett-Packard
    Product Name: HP 550
    Version: F.00
    Serial Number: CXXXXXX
    UUID: EXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX
    Wake-up Type: Power Switch
    SKU Number: FXXXXXXXXXXX#ACJ
    Family: 103C_5336AN

Handle 0x0012, DMI type 32, 11 bytes
System Boot Information
    Status: No errors detected

View Memory Details only:

sudo dmidecode -t memory

Sample Output:

# dmidecode 2.12
SMBIOS 2.4 present.

Handle 0x000A, DMI type 16, 15 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 4 GB
    Error Information Handle: No Error
    Number Of Devices: 2

Handle 0x000B, DMI type 17, 27 bytes
Memory Device
    Array Handle: 0x000A
    Error Information Handle: No Error
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 2048 MB
    Form Factor: SODIMM
    Set: None
    Locator: DIMM #1
    Bank Locator: Not Specified
    Type: DDR2
    Type Detail: Synchronous
    Speed: 975 MHz
    Manufacturer: Elpida                   
    Serial Number: 1XXXXXXXXX
    Asset Tag: Not Specified
    Part Number: EXXXXXXXXXXX

Handle 0x000C, DMI type 17, 27 bytes
Memory Device
    Array Handle: 0x000A
    Error Information Handle: No Error
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 2048 MB
    Form Factor: SODIMM
    Set: None
    Locator: DIMM #2
    Bank Locator: Not Specified
    Type: DDR2
    Type Detail: Synchronous
    Speed: 667 MHz
    Manufacturer: Nanya Technology         
    Serial Number: EXXXXXXXX
    Asset Tag: Not Specified
    Part Number: NXXXXXXXXXXXXXXX

View BIOS Details only:

sudo dmidecode -t bios

Sample Output:

# dmidecode 2.12
SMBIOS 2.4 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: Hewlett-Packard
    Version: 68MVU Ver. F.00
    Release Date: 05/23/2008
    Address: 0xE0000
    Runtime Size: 128 kB
    ROM Size: 1024 kB
    Characteristics:
        PCI is supported
        PC Card (PCMCIA) is supported
        PNP is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        Boot from CD is supported
        Selectable boot is supported
        EDD is supported
        3.5"/720 kB floppy services are supported (int 13h)
        Print screen service is supported (int 5h)
        8042 keyboard services are supported (int 9h)
        Serial services are supported (int 14h)
        Printer services are supported (int 17h)
        ACPI is supported
        USB legacy is supported
        LS-120 boot is supported
        Smart battery is supported
        BIOS boot specification is supported
        Function key-initiated network boot is supported
        Targeted content distribution is supported
    BIOS Revision: 15.0
    Firmware Revision: 18.0

For more details, refer the man pages.

man dmidecode

That’s all for now. Hope these tools will useful to you.

Cheers!