> ## Content Index
> Fetch the complete content index at: https://oyang.cc/llms.txt
> Use this file to discover other available public pages before exploring further.

# CentOS下查看CPU核数
- URL: https://oyang.cc/centosxia-cha-kan-cpuhe-shu/
- Published: 2020-03-19T14:06:37.000Z
- Updated: 2020-03-19T14:06:38.000Z
- Author: 轶语林
- Tags: centos, linux

当我们 cat /proc/cpuinfo 时，具有相同core id的CPU是同一个core的超线程，具有相同physical id的CPU是同一个CPU封装的线程或核心。

1. 查看CPU型号

```
[root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
      4  Intel(R) Xeon(R) CPU E7-8860 v4 @ 2.20GHz

```

1. 查看物理CPU个数

```
[root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq|wc -l
2

```

1. 查看逻辑CPU的个数

```
[root@localhost ~]# cat /proc/cpuinfo | grep "processor" |wc -l
4

```

1. 查看CPU是几核

```
[root@localhost ~]# cat /proc/cpuinfo | grep "cores"|uniq
cpu cores	: 2

```