Obtaining information about system hardware

If I want to accurately save information about the hardware I am using as a reference, what is the best way to do it? Are the contents of /proc/meminfo sufficient?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

There are several tools that you can use to capture specifics about your hardware. I would make use of the following set of tool to accomplish this.

NOTE: I would say no, /proc/meminfo is not sufficient, unless you just want to know how much RAM your system has.

System Info

lshw

This is a good tool for getting a general purpose list of what’s currently included in your system from a hardware perspective. It also includes what drivers are being used so it’s usually the first tool I go to for such things. It can show you specific hardware (network, CPU, RAM, etc.) and also output the results in a short format (shown below) as well as output in JSON, HTML, or XML.

Example

$ sudo lshw -short | head | expand
H/W path         Device     Class          Description
======================================================
                            system         900X3C/900X3D/900X4C/900X4D (System SKUNumber)
/0                          bus            NP900X4C-A07US
/0/0                        memory         128KiB BIOS
/0/4                        processor      Core i7 (To Be Filled By O.E.M.)
/0/4/6                      memory         32KiB L1 cache
/0/4/7                      memory         256KiB L2 cache
/0/4/8                      memory         4MiB L3 cache
/0/5                        memory         32KiB L1 cache

dmidecode

This tool takes a different approach and shows a dump of the system’s DMI tables. This is essentially the view of the system’s BIOS, in human readable form.

excerpt

dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS)
table contents in a human-readable format. This table contains a
description of the system’s hardware components, as well as other useful
pieces of information such as serial numbers and BIOS revision. Thanks to
this table, you can retrieve this information without having to probe for
the actual hardware. While this is a good point in terms of report speed
and safeness, this also makes the presented information possibly unreliable.

The DMI table doesn’t only describe what the system is currently made of, it
also can report the possible evolutions (such as the fastest supported CPU
or the maximal amount of memory supported).

SMBIOS stands for System Management BIOS, while DMI stands for Desktop
Management Interface. Both standards are tightly related and developed by the
DMTF (Desktop Management Task Force).

Example

$ sudo dmidecode | head -20
# dmidecode 2.12
# SMBIOS entry point at 0xdac46000
SMBIOS 2.7 present.
64 structures occupying 2909 bytes.
Table at 0xDAC45000.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: Phoenix Technologies Ltd.
    Version: P02ABK
    Release Date: 09/19/2012
    Address: 0xE0000
    Runtime Size: 128 kB
    ROM Size: 3072 kB
    Characteristics:
        PCI is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        Boot from CD is supported
        Selectable boot is supported

hwinfo

Another venerable tool for capturing a full snapshot of your system’s overall hardware. Similar to lshw, but IMO, probably the best overall tool for collecting this type of info. This is the tool that I generally reach for.

$ hwinfo --cpu | head -14
01: None 00.0: 10103 CPU
  [Created at cpu.446]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.58.9 "Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz"
  Features: fpu,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,lm,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,x2apic,popcnt,tsc_deadline_timer,xsave,avx,f16c,rdrand,lahf_lm,ida,arat,epb,xsaveopt,pln,pts,dtherm,tpr_shadow,vnmi,flexpriority,ept,vpid,fsgsbase,smep,erms
  Clock: 905 MHz
  BogoMips: 4789.57
  Cache: 4096 kb
  Units/Processor: 16
  Config Status: cfg=new, avail=yes, need=no, active=unknown

This is nice info since it includes just about anything you’d want to know about the make, model, and feature set of your given CPU.

CPU Info

lscpu

This tool will just show you specifics about your CPU.

Example

$ lscpu
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:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Model name:            Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz
Stepping:              9
CPU MHz:               1701.562
CPU max MHz:           3000.0000
CPU min MHz:           800.0000
BogoMIPS:              4789.57
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              4096K
NUMA node0 CPU(s):     0-3

cpuid

If you want to get into the nitty gritty details of your system’s CPU there’s cpuid.

$ cpuid -1 | less
   version information (1/eax):
      processor type  = primary processor (0)
      family          = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
      model           = 0xa (10)
      stepping id     = 0x9 (9)
      extended family = 0x0 (0)
      extended model  = 0x3 (3)
      (simple synth)  = Intel Core i3-3000 (Ivy Bridge L1) / i5-3000 (Ivy Bridge E1/N0/L1) / i7-3000 (Ivy Bridge E1) / Mobile Core i3-3000 (Ivy Bridge L1) / i5-3000 (Ivy Bridge L1) / Mobile Core i7-3000 (Ivy Bridge E1/L1) / Xeon E3-1200 v2 (Ivy Bridge E1/N0/L1) / Pentium G1600/G2000/G2100 (Ivy Bridge P0) / Pentium 900/1000/2000/2100 (P0), 22nm
   miscellaneous (1/ebx):
      process local APIC physical ID = 0x3 (3)
      cpu count                      = 0x10 (16)
      CLFLUSH line size              = 0x8 (8)
      brand index                    = 0x0 (0)
   brand id = 0x00 (0): unknown
   feature information (1/edx):
      x87 FPU on chip                        = true
      virtual-8086 mode enhancement          = true
      debugging extensions                   = true
      page size extensions                   = true
      time stamp counter                     = true
      RDMSR and WRMSR support                = true
      physical address extensions            = true
      machine check exception                = true
      CMPXCHG8B inst.                        = true
      APIC on chip                           = true
      SYSENTER and SYSEXIT                   = true
      memory type range registers            = true
      PTE global bit                         = true
      machine check architecture             = true
      conditional move/compare instruction   = true
      page attribute table                   = true
      page size extension                    = true
      processor serial number                = false
...

/proc/cpuinfo

If you just want to query info that the Linux Kernel provides about your CPU without having to utilize a tool, such as lscpu, you can always grok the /proc filesystem. In the same manner that you originally asked with /proc/meminfo, other hardware is also represented here as well, for example, the CPU.

$ head /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 58
model name  : Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz
stepping    : 9
microcode   : 0x1b
cpu MHz     : 892.406
cache size  : 4096 KB
physical id : 0

References

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply