LoginSignup
38
34

More than 5 years have passed since last update.

Linux のCPUの温度を知る方法

Last updated at Posted at 2018-10-31

ビルド中にファンが回るので、ちょっとCPUの温度が気になった。

準備

Ubuntu 18.04を使用しています。

sudo apt install lm-sensors

温度を一回だけ表示

sensorsコマンドを実行する。

$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +75.0°C  (high = +82.0°C, crit = +100.0°C)
Core 0:        +74.0°C  (high = +82.0°C, crit = +100.0°C)
Core 1:        +74.0°C  (high = +82.0°C, crit = +100.0°C)
Core 2:        +74.0°C  (high = +82.0°C, crit = +100.0°C)
Core 3:        +75.0°C  (high = +82.0°C, crit = +100.0°C)
Core 4:        +73.0°C  (high = +82.0°C, crit = +100.0°C)
Core 5:        +74.0°C  (high = +82.0°C, crit = +100.0°C)

iwlwifi-virtual-0
Adapter: Virtual device
temp1:        +56.0°C  

繰り返し表示する

watchコマンドと組み合わせる。デフォルトで2秒間隔で繰り返す。

watch sensors

余談

sensorsコマンドをstraceで見るとわかるが、これは/sys/class/hwmon/hwmon0/ 以下のファイルから情報を得ている。
なので、雑に温度を得るには以下のようにすればよい。

$ cat /sys/class/hwmon/hwmon0/temp?_input
77000
77000
77000
75000
77000
75000
74000
38
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
34