FreeBSD CPU Information Command

How do I get more information about CPU under FreeBSD operating systems such as CPU Speed and model using the command-line options?

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements FreeBSD Unix
Time 2m
You can use the dmesg utility displays the contents of the system message buffer when FreeBSD comes up. For accuracy I recommend querying /var/run/dmesg.boot file. Usually a snapshot of the buffer contents taken soon after file systems are mounted at startup time and dumped to /var/run/dmesg.boot file. This page explains how to find CPU information on FreeBSD Unix computer.

Check CPU Speed in FreeBSD using sysctl command

Type the following command at a shell prompt as root user:
# sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
OR
# sysctl hw.model hw.machine hw.ncpu
Sample outputs:

hw.machine: amd64
hw.model: Intel(R) Xeon(R) CPU           X3220  @ 2.40GHz
hw.ncpu: 4
hw.machine_arch: amd64

From the outputs, I have got an Intel Xeon quad core processor running at 2.40GHz from hw.model. The amd64 means 64 bit CPU and I have 4 core cpu as confirmed by hw.ncpu. Here is another output from my FreeBSD based firewall server:

Fig. 01: Finding out CPU info on a FreeBSD server/router

The i386 means I’ve got 32 bit CPU in my home router/firewall.

FreeBSD find out if CPU is 32bit or 64bit regardless of Intel/AMD/ARM CPU model

We need to use the NA command:
getconf LONG_BIT
And we see:

64

Releated: Linux Find If Processor (CPU) is 64 bit / 32 bit [long mode ~ lm]

FreeBSD CPUINFO using the dmesg command

Type the following command:
# dmesg | grep -i cpu
We can directly query /var/run/dmesg.boot file too:
# grep -i cpu /var/run/dmesg.boot
Here is what we see:

CPU: Dual Core AMD Opteron(tm) Processor 170 (1999.08-MHz 686-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
cpu0:  on acpi0
acpi_throttle0:  on cpu0
cpu1:  on acpi0
acpi_throttle1:  on cpu1
SMP: AP CPU #1 Launched!

You can also dump more information using sysctl command:
# sysctl -a | grep -i cpu | less

Installing packages to gain CPU information

We can use the following packages.

cpu-x app

CPU-X is a free software that gathers information about CPU, motherboard, and more on one’s system. It is similar to well-known CPU-Z program for Windows. It can be used in graphic mode by using GTK+3, or in text-based mode by using ncurses. Non-interactive dump mode is also available. Install it:
sudo pkg install cpu-x

cpuid app

Cpuid dumps detailed information about the CPU(s) gathered from the CPUID instruction, and also determines the exact model of CPU(s). It supports Intel, AMD, and VIA CPUs, as well as older Transmeta, Cyrix, UMC, NexGen, Rise, and SiS CPUs. Use the pkg command to install it:
sudo pkg install cpuid
cpuid | more

Detailed information about my CPU:

 eax in    eax      ebx      ecx      edx
00000000 00000016 756e6547 6c65746e 49656e69
00000001 000806ea 04100800 7ffafbff bfebfbff
00000002 76036301 00f0b5ff 00000000 00c30000
00000003 00000000 00000000 00000000 00000000
00000004 1c004121 01c0003f 0000003f 00000000
00000005 00000040 00000040 00000003 11142120
00000006 000027f7 00000002 00000009 00000000
00000007 00000000 029c6fbf 00000000 9c002600
00000008 00000000 00000000 00000000 00000000
00000009 00000000 00000000 00000000 00000000
0000000a 07300404 00000000 00000000 00000603
0000000b 00000001 00000002 00000100 00000004
0000000c 00000000 00000000 00000000 00000000
0000000d 0000001f 00000440 00000440 00000000
0000000e 00000000 00000000 00000000 00000000
0000000f 00000000 00000000 00000000 00000000
00000010 00000000 00000000 00000000 00000000
00000011 00000000 00000000 00000000 00000000
00000012 00000000 00000000 00000000 00000000
00000013 00000000 00000000 00000000 00000000
00000014 00000001 0000000f 00000007 00000000
00000015 00000002 000000b0 00000000 00000000
00000016 00000834 00001068 00000064 00000000
80000000 80000008 00000000 00000000 00000000
80000001 00000000 00000000 00000121 2c100800
80000002 65746e49 2952286c 726f4320 4d542865
80000003 37692029 3536382d 43205530 40205550
80000004 392e3120 7a484730 00000000 00000000
80000005 00000000 00000000 00000000 00000000
80000006 00000000 00000000 01006040 00000000
80000007 00000000 00000000 00000000 00000100
80000008 00003027 00000000 00000000 00000000

Vendor ID: "GenuineIntel"; CPUID level 22

Intel-specific functions:
Version 000806ea:
Type 0 - Original OEM
Family 6 - Pentium Pro
Model 142 - 
Stepping 10
Reserved 0

Extended brand string: "Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz"
CLFLUSH instruction cache line size: 8
Initial APIC ID: 4
Hyper threading siblings: 16

Feature flags set 1 (CPUID.01H:EDX): bfebfbff:
FPU    Floating Point Unit
.....
...
....
Structured feature flags CPUID.07H.00H:EBX: 029c6fbf:
FSGSBASE
IA32_TSC_ADJUST MSR
2 - unknown feature
BMI1
HLE
AVX2
SMEP
BMI2
Enhanced REP MOVSB/STOSB
INVPCID
RTM
Deprecates FPU CS and FPU DS
14 - unknown feature

dmidecode DMI table decoder app

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. Install it:
sudo pkg install dmidecode
Type:
sudo dmidecode | more
sudo dmidecode -t processor

Conclusion

We explained various command-line options to display information about installed CPU under FreeBSD operating systems.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 11 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
11 comments… add one
  • Eugene Markow Aug 2, 2008 @ 4:39

    In ‘dmesg -a’, my cpu speed is clearly displayed as “CPU: AMD Athlon(tm) Processor (998.07-MHz 686-class CPU)”.

    When I used:

    ‘sysctl -a | egrep -i ‘hw.machine|hw.model|hw.ncpu’.

    the following was displayed:

    hw.machine: i386
    hw.model: AMD Athlon(tm) Processor
    hw.ncpu: 1
    hw.machine_arch: i386

    Why wasn’t the ‘speed’ of my processor displayed. It isn’t present anywhere in ‘sysctl -a’ either. Anyone know why? Thanks.

  • Paul Mar 12, 2009 @ 23:28

    Thanks for the info, while the sysctl line didn’t work b/c it lacked the CPU speed grepping dmesg.boot worked like a charm.

  • Casey Hillman May 3, 2009 @ 19:21

    Clockspeed is in sysctl, it is hw.clockrate

    ‘sysctl -a | grep hw.clockrate’

  • Chris LaFond Aug 5, 2009 @ 3:59

    Quick question,
    my output shows:
    palamon# sysctl -a | egrep -i ‘hw.machine|hw.model|hw.ncpu’
    hw.machine: i386
    hw.model: Intel(R) Pentium(R) 4 CPU 2.00GHz
    hw.ncpu: 1
    hw.machine_arch: i386

    with this, will my programs run slower for being compiled to run on a 386?
    should it be at least 686?
    Thanks

  • dev Sep 4, 2009 @ 17:54

    is i386 32 and 64 bit capable?

  • Mr. Mead Jan 17, 2011 @ 15:35

    ‘sysctl -a | grep hw.clockrate’
    seriously!?

    sysctl hw.clockrate

    kthxbye

  • me Aug 3, 2013 @ 13:25

    no dude, you DON’T HAVE a cpu running at 2.4G
    you have a cpu that can run at 2.4G
    what’s the difference … hmmm … in linux

    cat /proc/cpuinfo | grep -i cpu
    cpu family : 6
    model name : Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
    cpu MHz : 800.000
    cpu cores : 2
    cpuid level : 10
    cpu family : 6
    model name : Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
    cpu MHz : 800.000
    cpu cores : 2
    cpuid level : 10

    so, it is running at 800MHz not 2.4GHz …

  • theManda Jan 17, 2014 @ 11:55

    more simple way

    sysctl hw.model hw.machine hw.ncpu
    hw.model: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
    hw.machine: amd64
    hw.ncpu: 8
  • Aakaash Aug 4, 2014 @ 4:09

    In that output:

    hw.machine: amd64
    hw.model: Intel(R) Xeon(R) CPU X3220 @ 2.40GHz
    hw.ncpu: 4
    hw.machine_arch: amd64

    Why AMD and Intel are coming together? Sorry if this question is silly.

  • Ruben Schade Dec 20, 2014 @ 23:10

    There’s a lot of confusion in the comments here. Given this page ranks highly in The Google, I’ll throw in my 20 cents (adjusted for inflation).

    “i386” means 32bit, “amd64” means 64bit. In brief, this is due to AMD having designed the original 64bit extensions for x86. Intel Core CPUs will still be listed as amd64 on the BSDs.

    In Linux, “/proc/cpuinfo” shows the capabilities of a CPU, but it may be throttling down for power saving. When you require the performance, it will revert to its full performance.

    There aren’t any silly questions. We learn by researching and asking :).

  • Lon Kaut Mar 25, 2017 @ 3:22

    dmidecode -t 4
    also yields a comprehensive CPU info:

    # dmidecode 3.0
    Outputs:

    Scanning /dev/mem for entry point.
    SMBIOS 2.7 present.
    
    Handle 0x0004, DMI type 4, 42 bytes
    Processor Information
    	Socket Designation: Socket-B2 1356
    	Type: Central Processor
    	Family: Xeon
    	Manufacturer: Intel            
    	ID: D2 06 02 00 FF FB EB BF
    	Signature: Type 0, Family 6, Model 45, Stepping 2
    	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: Genuine Intel(R) CPU @ 2.00GHz
    	Voltage: 1.0 V
    	External Clock: 100 MHz
    	Max Speed: 4000 MHz
    	Current Speed: 2000 MHz
    	Status: Populated, Enabled
    	Upgrade: Socket LGA1356
    	L1 Cache Handle: 0x0005
    	L2 Cache Handle: 0x0006
    	L3 Cache Handle: 0x0007
    	Serial Number: To Be Filled By O.E.M.
    	Asset Tag: To Be Filled By O.E.M.
    	Part Number: To Be Filled By O.E.M.
    	Core Count: 6
    	Core Enabled: 6
    	Thread Count: 12
    	Characteristics:
    		64-bit capable
    
    Handle 0x0008, DMI type 4, 42 bytes
    Processor Information
    	Socket Designation: Socket-B2 1356
    	Type: Central Processor
    	Family: Xeon
    	Manufacturer: Intel            
    	ID: D2 06 02 00 FF FB EB BF
    	Signature: Type 0, Family 6, Model 45, Stepping 2
    	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: Genuine Intel(R) CPU @ 2.00GHz
    	Voltage: 1.0 V
    	External Clock: 100 MHz
    	Max Speed: 4000 MHz
    	Current Speed: 2000 MHz
    	Status: Populated, Enabled
    	Upgrade: Socket LGA1356
    	L1 Cache Handle: 0x0009
    	L2 Cache Handle: 0x000A
    	L3 Cache Handle: 0x000B
    	Serial Number: To Be Filled By O.E.M.
    	Asset Tag: To Be Filled By O.E.M.
    	Part Number: To Be Filled By O.E.M.
    	Core Count: 6
    	Core Enabled: 6
    	Thread Count: 12
    	Characteristics:
    		64-bit capable

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz