在Linux上显示处理器数量

If you’ve just upgraded your Linux box, or you are wondering how many processors a remote server has, there’s a quick and dirty command you can use to display the number of processors.

如果您刚刚升级了Linux机器,或者想知道远程服务器有多少个处理器,那么可以使用一个快速而肮脏的命令来显示处理器数量。

On Linux, /proc/cpuinfo contains all of the processor information for all current processors in your computer. This will include the speed, the amount of on-chip cache, processor type, and how many cores.

在Linux上,/ proc / cpuinfo包含计算机中所有当前处理器的所有处理器信息。 这将包括速度,片上高速缓存的数量,处理器类型以及多少个内核。

Here’s the command:

这是命令:

cat /proc/cpuinfo | grep processor | wc -l

猫/ proc / cpuinfo | grep处理器| wc -l

The command just looks in the /proc/cpuinfo file, pulls out the number of lines containing the word “processor” and passes them into wc (word count), which returns a count of the CPUs in the system.

该命令仅在/ proc / cpuinfo文件中查找,取出包含“处理器”一词的行数,并将它们传递到wc(字数)中,后者返回系统中CPU的数量。

Here’s what it returned on my remote server:

这是它在我的远程服务器上返回的内容:

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

[root @ root]#cat / proc / cpuinfo | grep处理器| wc -l

4

4

Note that if you have a dual-core processor, it will return each core as a separate processor. You can look at the full output of cat /proc/cpuinfo to see if the chips are dual-core.

请注意,如果您有双核处理器,它将把每个核作为单独的处理器返回。 您可以查看cat / proc / cpuinfo的完整输出以查看芯片是否为双核。

翻译自: https://www.howtogeek.com/howto/ubuntu/display-number-of-processors-on-linux/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值