2

I know of several ways to obtain information about my CPU in a GNU/Linux environment, from cat /proc/cpuid to various utilities, see e.g. here

However, none of them seems to tell me what my CPU model name is. I mean, I have (for the sake of discussion) an Intel Pentium 4 530J. But the kind of information I can get about it is basically: Manufacturer/Vendor, Family-Model-Stepping, Clock speed (well, some more fields but this should be enough to uniquely identify the brand I think).

On Windows we have free (as in beer) utilities such as HWInfo which tell us the brand name (in my case - the number 530 has to appear somewhere). Isn't there something similar for Linux as well?

Notes:

  • Nothing requiring a graphical environment, please. Strictly command-line...
  • HWInfo does detect the CPU as an "Intel Pentium 4 530J (Prescott, E0)". That's basically what I want to be seeing.
Hennes
  • 65,804
  • 7
  • 115
  • 169
einpoklum
  • 10,666

2 Answers2

4

The simplest, native would be cat /proc/cpuinfo|grep vendor_id

[geek@phoebe ~]$ cat /proc/cpuinfo | grep vendor_id
vendor_id       : GenuineIntel
vendor_id       : GenuineIntel

(Its printed twice cause this is a dual core system)

Interestingly this dosen't work with my raspi, which has a very different format

I don't think its preinstalled on many distros, but lshw would do the trick as well. Use the -class cpu flag to just dump out the relevant information

 sudo lshw -class cpu
  *-cpu
       description: CPU
       product: Celeron (Fill By OEM)
       vendor: Intel Corp.
       physical id: 34
       bus info: cpu@0
       version: Intel(R) Celeron(R) CPU N2807 @ 1.58GHz
       slot: SOCKET 0
       size: 1960MHz
       capacity: 2400MHz
       width: 64 bits
       clock: 83MHz

Likewise, this dosen't work on my raspberry pi quite the same way either. This should be consistent with x86 boxen however.

The equivalent AMD vendor name for lshw is Advanced Micro Devices (AMD) and the /proc/cpuinfo readout for vendor_id is AuthenticAMD

(You can find a full list of vendor_ids here)

In short, the vendor flag should identify the 'brand' and the product flag should identify what its sold as.

Journeyman Geek
  • 133,878
0

Well, on Wikipedia, there’s an example (x86_64 only) assembly listing for this very purpose:

.section .data

s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"

.section .text

.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx

    movl    $0x80000000,    %eax
    cpuid

    cmpl    $0x80000004,    %eax
    jl  error

    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi

.align 16
get_brand:
    movl    %esi,   %eax
    cpuid

    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)

    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand

print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf

    jmp end

.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf

.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

This method probably won’t work for you, since it seems Pentium 4/D CPUs don’t have their model name available this way. As you can see here, the CPUID data doesn’t contain what you want.

user219095
  • 65,551