How to Check the CPU Type in FreeBSD (sysctl and dmesg)
How to find out which processor is installed in a FreeBSD server.
Run this command:
sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
The output looks like this:
hw.machine: amd64 hw.model: Dual-Core AMD Opteron(tm) Processor 2216 hw.ncpu: 2 hw.machine_arch: amd64
(By the way, here is a note on how to check the processor in Linux.)
Another example:
hw.machine: amd64 hw.model: Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz hw.ncpu: 4 hw.machine_arch: amd64
The output shows:
- the processor vendor;
- the model;
- the number of cores allocated to the system (it can differ, for example, under virtualization);
- the system architecture.
You can also find the CPU model in FreeBSD like this:
grep -i cpu /var/run/dmesg.boot
Example output:
CPU: Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz (3292.52-MHz K8-class CPU) FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs
(I deliberately changed the number of cores in the ESXi hypervisor, which is why it shows 6. The E3-1230 V2 has 4 physical cores and 8 threads.)
There are many utilities for detecting server hardware, but why install anything if one of these commands is enough?
