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

Question :

How to display the number of Virtual processor(vCPU) on linux Virtual Private Server (VPS) or Virtual Dedicated Server (VDS) ?

Answer :

To display the number of virtual processor(cpu) on linux vps, you have to run any of this command :

1. This command will display exact number of virtual cpu (vCPU) :

[root@centos62 ~]# cat /proc/cpuinfo | grep processor | wc -l
2

2. This command will grep any available vCPU. First cpu will start with 0.

Example of linux CentOS server with 1 vCPU :

[root@centos62 ~]# cat /proc/cpuinfo | grep processor
processor       : 0

Example of linux CentOS server with 2 vCPU :

[root@centos62 ~]# cat /proc/cpuinfo | grep processor
processor       : 0
processor       : 1

or this command will return the same result as steps (2).

[root@centos62 ~]# grep processor /proc/cpuinfo
processor       : 0

For additional information, you can display the number of cores on each CPU. Either Duo/Quad?

[root@centos62 ~]# cat /proc/cpuinfo |grep cpu\ cores |uniq
cpu cores       : 4