9

3 招轻松查看 Linux CPU 详细信息:型号、核心数和温度

 5 months ago
source link: https://www.sysgeek.cn/check-cpu-info-linux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Linux

作为一个 Linux 用户,无论你是自建服务器还是租用云主机、VPS,了解 CPU 的性能和参数都至关重要。CPU 有多少核心数?资源占用率如何?是物理处理器还是虚拟 CPU?这些问题,都能在 Linux 系统中找到答案。

接下来,本文将介绍如何在 Linux 中轻松查看 CPU 的详细信息。

方法 1:使用 lscpu 命令 – 在 Linux 中查看 CPU 详细信息

在 Linux 系统中,查看 CPU 详细信息最简单直接的方法是使用lscpu命令。它适用于主流 Linux 发行版,无需额外安装即可使用。

复制复制复制复制
复制
lscpu
使用 lscpu 命令查看 CPU 参数
使用 lscpu 命令查看 CPU 参数

输出结果包含了丰富的 CPU 相关信息,例如:

  • Architecture:CPU 是 64 位还是 32 位。
  • CPU op-mode(s):CPU 支持的进程模式。
  • Address sizes:系统可寻址的内存大小。
  • Byte Order:字节顺序是 Little Endian 还是 Big Endian。
  • CPU(s):逻辑和物理核心的数量。
  • On-line CPU(s) list:哪些核心是激活状态。
  • Vendor ID:CPU 制造商。
  • Model name:CPU 型号。
  • CPU family 和 Model:处理器的系列和内部型号。
  • Thread(s) per core:每个核心的线程数。
  • Core(s) per socket:物理核心总数。
  • Socket:CPU 插槽数量。
  • Stepping:CPU 型号的修订次数。
  • CPU max 和 CPU min:CPU 的频率范围。
  • BogoMips:是一个已过时的 CPU 速度指标。
  • Virtualization:CPU 支持的虚拟化技术,例如 Intel 的VT-x
  • Caches (sum of all):各级别的 CPU 缓存容量。
  • NUMA node(s):CPU 核心与内存模块的物理布局。

方法 2:使用 htop 命令 – 在 Linux 中查看 CPU 核心使用率

虽然我们可以直接使用top命令来查看 CPU 的使用率,但htop命令提供了更友好的界面,能够在 Linux 系统中更清晰地显示 CPU 核心数量,以及每个核心的占用率。

1在大多数 Linux 发行版中,htop需要先安装。安装命令如下:

  • Ubuntu:sudo apt install htop
  • Fedora:sudo dnf install htop
  • Arch Linux:sudo pacman -S htop

2安装完成后,在终端中执行以下命令:

复制复制复制
复制
htop
使用 htop 查看 CPU 内核使用率
使用 htop 查看 CPU 内核使用率

htop界面中,你可以一目了然地看到每个核心的占用率。

方法 3:使用 sensors 命令 – 在 Linux 中查看 CPU 温度

lm-sensors是一个强大的工具,可以在 Linux 中查看包括 CPU 温度在内的硬件温度和风扇转速。

1安装lm-sensors工具:

  • Ubuntu:sudo apt install lm-sensors
  • Fedora:sudo dnf install lm_sensors
  • Arch Linux:sudo pacman -S lm_sensors

2安装完成后,在终端中执行以下命令:

复制复制
复制
sensors
使用 lm-sensors 查看 CPU 温度
使用 lm-sensors 查看 CPU 温度

你将获得 CPU 温度的实时数据,帮助你更好地了解系统的热状态。


通过上述三种方法,你可以轻松掌握 Linux 系统中 CPU 的详细信息,从而更好地优化系统性能和稳定性。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK