Help us understand the problem. What is going on with this article?

Linux のCPUの温度を知る方法

More than 1 year has passed since last update.

ビルド中にファンが回るので、ちょっと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
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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
ユーザーは見つかりませんでした