FreeBSD CPU Information Command

How do I get more information about CPU under FreeBSD operating systems such as CPU Speed and model?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
TimeN/A
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.

ADVERTISEMENTS

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’ve an Intel Xeon quad core processor running at 2.40GHz. Here is another output from my FreeBSD based firewall server:

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

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

FreeBSD CPUINFO using the dmesg command

Type the following command:
# dmesg | grep -i cpu
Or directly query /var/run/dmesg.boot file:
# grep -i cpu /var/run/dmesg.boot
Sample outputs:

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

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 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 VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
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>, <code>...</code> and <kbd>...</kbd> for code samples.