LinuxサーバーでCPUの情報を確認するコマンドを以下に示します。XServer VPSでも同様に使用できます。
1. 簡易的に確認する
コマンド
lscpu
- 説明: CPUに関する基本情報(モデル名、コア数、アーキテクチャなど)を一覧表示します。
- 出力例(一部)
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 40 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: AuthenticAMD
Model name: AMD EPYC-Milan Processor
CPU family: 25
Model: 1
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 4
Stepping: 1
・・・
2. 詳細情報を確認する
コマンド
cat /proc/cpuinfo
- 説明: 各CPUコアの詳細情報を表示します。
- 出力例(一部)
processor : 0
vendor_id : AuthenticAMD
cpu family : 25
model : 1
model name : AMD EPYC-Milan Processor
stepping : 1
microcode : 0x1000065
cpu MHz : 1996.250
cache size : 512 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : ***
bugs : ***
bogomips : 3992.50
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
3. 使用率と動作状況を確認する
コマンド
top
- 説明: CPUの使用率をリアルタイムで確認します。
- 出力例

別の方法
htop
- 説明:
top
コマンドの視覚的なバージョンで、各CPUコアの使用率をカラー表示。 - 注意:
htop
は別途インストールが必要な場合があります。
sudo apt install htop # Debian/Ubuntu系
sudo yum install htop # CentOS/RHEL系
- 出力例

4. 実行中のプロセス別のCPU使用率を確認
コマンド
ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu
- 説明: CPU使用率の高いプロセスを上位から表示します。
- 出力例
PID PPID CMD %CPU %MEM
9955494 1 /lib/systemd/systemd --user 1.2 0.2
5. CPUの温度や詳細ステータスを確認する
コマンド
sensors
説明: CPU温度やファン速度を確認。
注意: sensors
コマンドを使うにはlm-sensors
のインストールが必要です。
sudo apt install lm-sensors # Debian/Ubuntu系
sudo yum install lm_sensors # CentOS/RHEL系
使い方
sudo sensors-detect
sensors
Usage: sensors [OPTION]... [CHIP]...
-c, --config-file Specify a config file
-h, --help Display this help text
-s, --set Execute `set' statements (root only)
-f, --fahrenheit Show temperatures in degrees fahrenheit
-A, --no-adapter Do not show adapter for each chip
--bus-list Generate bus statements for sensors.conf
-u Raw output
-j Json output
-v, --version Display the program version
6. CPUの使用可能な周波数範囲を確認
コマンド
cpufreq-info
- 説明: CPUの周波数スケーリング情報を表示。
- 注意:
cpufreq-utils
のインストールが必要な場合があります。
sudo apt install cpufrequtils # Debian/Ubuntu系
sudo yum install cpufrequtils # CentOS/RHEL系
Usage: cpufreq-info [options]
Options:
-c CPU, --cpu CPU CPU number which information shall be determined about
-e, --debug Prints out debug information
-f, --freq Get frequency the CPU currently runs at, according
to the cpufreq core *
-w, --hwfreq Get frequency the CPU currently runs at, by reading
it from hardware (only available to root) *
-l, --hwlimits Determine the minimum and maximum CPU frequency allowed *
-d, --driver Determines the used cpufreq kernel driver *
-p, --policy Gets the currently used cpufreq policy *
-g, --governors Determines available cpufreq governors *
-r, --related-cpus Determines which CPUs run at the same hardware frequency *
-a, --affected-cpus Determines which CPUs need to have their frequency
coordinated by software *
-s, --stats Shows cpufreq statistics if available
-y, --latency Determines the maximum latency on CPU frequency changes *
-o, --proc Prints out information like provided by the /proc/cpufreq
interface in 2.4. and early 2.6. kernels
-m, --human human-readable output for the -f, -w, -s and -y parameters
-h, --help Prints out this screen
おすすめの使い分け
- 全体概要を確認 →
lscpu
- 詳細な情報を確認 →
cat /proc/cpuinfo
- リアルタイム使用率を確認 →
top
/htop
- プロセスごとの使用率 →
ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu
必要に応じてこれらのコマンドを活用してください。
コメント