Linux下查看系统CPU个数、核心数、线程数

1.查看物理CPU个数

(env) root@vmware01:~# grep 'physical id' /proc/cpuinfo 
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
(env) root@vmware01:~# grep 'physical id' /proc/cpuinfo | sort -u
physical id    : 0
(env) root@vmware01:~# 

2.查看核心数量

 

(env) root@vmware01:~# grep 'core id' /proc/cpuinfo | sort -u |wc -l
4
(env) root@vmware01:~# grep 'core id' /proc/cpuinfo |wc -l
8
(env) root@vmware01:~# 

 

3.查看线程数

 

(env) root@vmware01:~# grep 'processor' /proc/cpuinfo | sort -u | wc -l
8
(env) root@vmware01:~# grep 'processor' /proc/cpuinfo |  wc -l
8
(env) root@vmware01:~# 

 

示例:

(env) root@vmware01:~# grep 'physical id' /proc/cpuinfo 
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
physical id    : 0
(env) root@vmware01:~# grep 'core id' /proc/cpuinfo |wc -l
8
(env) root@vmware01:~# grep 'processor' /proc/cpuinfo |  wc -l
8
(env) root@vmware01:~# 

上边这台服务器可以看到有8个CPU,8个核心,每个核心8个线程,共8×8×8=512个线

 查看CPU相关信息

(env) root@vmware01:~# vim /proc/cpuinfo 
(env) root@vmware01:~# 

 

posted @ 2018-10-11 15:28 前方、有光 阅读(...) 评论(...) 编辑 收藏