Checking the CPU Model on CentOS 7

On CentOS 7, inspecting the CPU model usually means verifying hardware, checking a VM against its plan, or recording node specs.

1. The quickest command

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

Example output:

[root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
     40  Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz

The leading 40 is the logical CPU count. The text after the colon is the model name.

1.1 What each part does

Segment Purpose
cat /proc/cpuinfo Read the CPU data exposed by the kernel
grep name Keep only the model lines
cut -f2 -d: Split by colon and return the model field
uniq -c Merge identical lines and count occurrences

Because /proc/cpuinfo prints one block per logical CPU, the model line repeats many times. uniq -c collapses the duplicates so the number becomes useful.

1.2 When this command is enough

If you only need to confirm that the machine matches the quote or the provider plan, this command is enough. For benchmarking or capacity planning, add more fields.

2. Better alternatives

2.1 lscpu

lscpu

lscpu gives you a more readable summary of architecture, core count, thread count, model name, and cache information.

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Model name:            Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
CPU(s):                40

2.2 Direct model lookup

cat /proc/cpuinfo | grep "model name"
---

This is useful when you only need the model string and not the count.

2.3 Physical cores vs logical CPUs

# Physical cores
grep "core id" /proc/cpuinfo | sort -u | wc -l

# Logical CPUs
nproc

On virtualized hosts or on systems with hyper-threading enabled, the physical and logical counts will not match. That distinction matters when you compare pricing or estimate capacity.

3. A small inventory script

echo "Model: $(lscpu | awk -F: '/Model name/ {gsub(/^ +/, "", $2); print $2; exit}')"
echo "Logical CPUs: $(nproc)"
echo "Physical cores: $(grep 'core id' /proc/cpuinfo | sort -u | wc -l)"

That output is handy for notes and migration checklists.

3.1 A batch collection pattern

Scenario Recommendation
Single host check Run commands directly
Fleet audit Write to a file
Asset registry Import into CMDB
#!/bin/bash
hostname
lscpu | awk -F: '/Model name|CPU\(s\)|Thread|Core/ {gsub(/^ +/, "", $2); print $1 ": " $2}'

4. When to check it

  • Before buying or migrating a server.
  • When a VM seems slower than expected and you want to rule out an instance mismatch.
  • Before benchmarking, so you can keep the hardware baseline consistent.

If you are planning a new server purchase, combine the hardware and deployment articles in the cloud servers category with the server selection guide and the server benchmark guide.

4.1 Common mistakes

Mistake Why it is a problem
Looking only at the model Core and thread counts matter too
Looking only at logical CPUs It does not equal physical capacity
Checking once only Specs can change after resize or migration

5. Reference note

Original post: https://www.cnblogs.com/cqzhuomi/articles/17297845.html (cnblogs.com CQZHUOMI, repost)

Keeping lscpu, nproc, and /proc/cpuinfo together in your records makes later performance comparisons much easier.

6. One more hardware check

If you also want to confirm the motherboard, BIOS, or machine serial number, CentOS 7 can expose that too.

dmidecode -t processor | grep -E 'Version|Core Count|Thread Count'
hostnamectl

These commands are easy to add to an inventory script. For operations records, it is better to capture the model, core count, thread count, and serial number in one pass so later troubleshooting is faster.

Field Use
Model Match purchase and instance spec
Core count Estimate performance
Thread count Judge concurrency
Serial number Asset registration

7. Put the results into an asset table

If you manage machines in bulk, record the CPU model, core count, thread count, memory, and disk in one asset table. That way you do not need to inspect each host again when you plan scaling, migration, or benchmarking.

Asset field Suggested content
Hostname Unique node identifier
CPU model Exact model string
Logical cores Result from nproc
Physical cores core id summary
Memory free -h
Disk lsblk

That may look simple, but it is extremely useful when you revisit a performance issue later. Many “the app is slow” cases end up being a hardware-spec mismatch.

If you also need to compare against benchmark results later, archive the lscpu output, the machine model, and the benchmark timestamp together. That lets you review how the same host behaved at different points in time without collecting the data again.

7.1 Record template

If you want to write this into a document, use a fixed template: hostname, CPU model, core count, thread count, memory, disk, and capture time. Once the template is standardized, side-by-side comparisons become much easier.

Field Example
Hostname web-01
Capture time 2026-08-07 10:00

You can go one step further and save the output of free -h and lsblk too. CPU is only part of the picture; memory and disk often end up being the real bottlenecks for user experience.

7.2 How to handle batch checks

If you manage multiple CentOS 7 machines, the easiest approach is not to log into each host manually. Put the commands into a small audit script so one run can capture the model, core count, thread count, and hostname in the same output. That makes it much easier to paste into a spreadsheet or ticket later.

#!/bin/bash
echo "Host: $(hostname)"
echo "Model: $(lscpu | awk -F: '/Model name/ {gsub(/^ +/, "", $2); print $2; exit}')"
echo "Logical CPUs: $(nproc)"
echo "Physical cores: $(grep 'core id' /proc/cpuinfo | sort -u | wc -l)"

7.3 A more useful inspection table

Check item Why it matters How to read it
Model Confirms the hardware spec Does it match the quote or instance plan?
Logical cores Indicates concurrency Is it enough for the workload?
Physical cores Shows actual compute capacity Are you being misled by hyper-threading?
Architecture Compatibility check Is it x86_64 or something else?
Cache Performance reference Is it suitable for heavy workloads?

7.4 Common troubleshooting scenarios

  1. After a VM upgrade, lscpu shows a different model string. First confirm whether the instance type actually changed.
  2. During benchmarking, the logical core count looks high but the results are mediocre. Check whether the gap comes from physical cores versus hyper-threading.
  3. If a fleet audit returns inconsistent values, inspect the image version and virtualization platform first.

If you want to preserve this data over time, have the audit script write the output directly to a text file or spreadsheet export. That keeps the information available for performance reviews, scaling decisions, and purchasing comparisons.