'totalcpu'에 해당되는 글 1건

Check how many CPUs are there in Linux system

last updated October 15, 2018 in CategoriesCentOS, Debian / Ubuntu, Hardware, Linux, RedHat and Friends, Suse

How do you check how many CPUs are there in Linux system using the command line option?

 

Introduction: One can obtain the number of CPUs or cores in Linux from the command line. The /proc/cpuinfo file stores CPU and system architecture dependent items, for each supported architecture. You can view /proc/cpuinfo with the help of cat command or grep command/egrep command. This page shows how to use /proc/cpuinfo file and lscpu command to display number of processors on Linux.

How do you check how many CPUs are there in Linux system?

You can use one of the following command to find the number of physical CPU cores including all cores on Linux:

  1. lscpu command

  2. cat /proc/cpuinfo

  3. top or htop command

  4. nproc command

  5. hwinfo command

  6. dmidecode -t processor command

  7. getconf _NPROCESSORS_ONLN command

Let us see all commands and examples in details.

How to display information about the CPU on Linux

Just run the lscpu command:

$ lscpu

$ lscpu | egrep 'Model name|Socket|Thread|NUMA|CPU\(s\)'

$ lscpu -p

 

The output clearly indicate that I have:

  1. CPU model/make: AMD Ryzen 7 1700 Eight-Core Processor

  2. Socket: Single (1)

  3. CPU Core: 8

  4. Thread per core: 2

  5. Total threads: 16 ( CPU core[8] * Thread per core [2])

Use /proc/cpuinfo to find out how many CPUs are there in Linux

The lscpu command gathers CPU architecture information from sysfs, /proc/cpuinfo and other sources. To view use the cat command and more command as follows:

$ cat /proc/cpuinfo

 

OR

$ more /proc/cpuinfo

 

Let us print cpu thread count:

$ echo "CPU threads: $(grep -c processor /proc/cpuinfo)"

$ grep 'cpu cores' /proc/cpuinfo | uniq

Run top or htop command to obtain the number of CPUs/cores in Linux

Simply run the following command and hit ‘1’:

$ top

 

 

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,