Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
30
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

@tetsu_koba

Linux のCPUの温度を知る方法

ビルド中にファンが回るので、ちょっと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
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
30
Help us understand the problem. What are the problem?