How To Display Number Of Processors in Linux

If you want to know Total Number of Processors in Linux, execute following commands.

Run the following command to find out the number of processors in your machine.

[root@amitmaheshwari.in]# cat /proc/cpuinfo | grep processor | wc -l

We use the "cat" command to print the file on the standard output and pass it to the "grep" command as input. Then we tell grep to find the word "processor" and grep it. But, how many times does this word appear? The wc command is used to count word and it helps us to solve our problem.
I get the following output after running the above command.

[root@amitmaheshwari.in]# cat /proc/cpuinfo | grep processor | wc -l
4

The "/proc/cpuinfo" is a plain text file that contains information about the central processing units on a computer. You can use the cat command to display its content on the terminal and find alot of information by yourself.

Warning: The /proc/cpuinfo is a read-only file so do not try to make any changes to it or you will end up damaging the file and probably your system.