How to Display the Number of Processors (vCPU) on Linux VPS

Virtual Private Servers (VPS) are virtualized environments that run multiple instances of an operating system on a single physical server. In a VPS environment, the number of virtual CPUs (vCPUs) allocated to a virtual machine (VM) determines its computing power. It is essential to know the number of vCPUs available on a Linux VPS for optimal resource allocation and application performance.

In this guide, we will show you how to display the number of processors (vCPUs) available on your Linux VPS. We will use two simple commands to achieve this. The first command will display the CPU details, including the number of cores, while the second command will show the number of processors (vCPUs) assigned to the VM.

See also  How to Configure Load Balancing Strategies with HAProxy

Step 1: Display CPU Details

To display CPU details, we will use the lscpu command. This command prints out detailed information about the processor architecture and its configuration.

Open your terminal and type:

lscpu

The output of this command will show you the number of cores, threads per core, and other details of your CPU architecture.

For example:

root@geeks:~# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           8
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Gold 6336Y CPU @ 2.40GHz
Stepping:            6
CPU MHz:             2399.998
BogoMIPS:            4799.99
Virtualization:      VT-x
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            4096K
L3 cache:            16384K
NUMA node0 CPU(s):   0-7

Step 2: Display the Number of vCPUs Assigned to the VM

To display the number of vCPUs assigned to the VM, we will use the nproc command. This command prints the number of processing units available to the current process. In a virtualized environment, this command displays the number of vCPUs assigned to the VM.

See also  How to Setup a Dedicated Server for your Website in Just 9 Steps

Open your terminal and type:

nproc

The output of this command will show you the number of vCPUs assigned to the VM.

root@geeks:~# nproc
8

Commands Mentioned:

  • lscpu – displays CPU details
  • nproc – displays the number of vCPUs assigned to the VM

Conclusion:

In this guide, we have shown you how to display the number of processors (vCPUs) available on your Linux VPS. We used two simple commands, lscpu to display CPU details and nproc to show the number of vCPUs assigned to the VM. Knowing the number of vCPUs available on your VPS is essential for optimal resource allocation and application performance.

See also  How to use Basic Regular Expression with grep command on Linux

If you have any comments or suggestions for improvements, please feel free to leave them below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *