Verifying the Number of Cores Available to Linux
When managing a Virtual Private Server (VPS) running Linux, it’s crucial to understand its resources to optimize performance. One such resource is the number of CPU cores. The more cores you have, the more tasks your VPS can handle simultaneously. Here’s a guide on how to check the number of CPU cores on a Linux VPS.The /proc/cpuinfo
File
One of the simplest methods to determine the number of CPU cores is by reading the /proc/cpuinfo
file.
Command:
Shell
The lscpu
Command
The lscpu
command provides detailed information about the CPU architecture.
Command:
Shell
The nproc
Command
For a straightforward count of available processing units, use nproc
.
Command:
Shell
The top
and htop
Commands
Both top
and htop
are interactive process viewers that display the system’s current state.
Using top:
Command:
Shell
Shell
htop
, you will directly see a visual representation of the usage of each core at the top of the interface.
The hwinfo
Command
hwinfo
provides detailed hardware information, including about the CPU.
Command (to specifically get CPU info):
Shell