How to get CPU temperature in Ubuntu Linux

Time:2021-4-20

Lm_ Sensors is a command line tool used to display the current readings of all chip sensor data, including CPU temperature. By default, LM is not installed in Ubuntu Linux_ Sensors, so we have to install them ourselves.

[email protected]:~$ sudo apt install lm-sensors
Test hardware
Next, we need to detect the hardware monitoring chip installed on the computer. Now we can start to detect the hardware sensors of the computer

[email protected]:~$ sudo sensors-detect

sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)

System: VMware, Inc. VMware Virtual Platform [None]

Board: Intel Corporation 440BX Desktop Reference Platform

Kernel: 4.15.0-30Ubuntu-generic x86_64

Processor: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (6/158/10)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you’re doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): yes
Silicon Integrated Systems SIS5595… No
VIA VT82C686 Integrated Sensors… No
VIA VT8231 Integrated Sensors… No
AMD K8 thermal sensors… No
AMD Family 10h thermal sensors… No
AMD Family 11h thermal sensors… No
AMD Family 12h and 14h thermal sensors… No
AMD Family 15h thermal sensors… No
AMD Family 16h thermal sensors… No
AMD Family 17h thermal sensors… No
AMD Family 15h power sensors… No
AMD Family 16h power sensors… No
Intel digital thermal sensor… Success!

(driver `coretemp')

Intel AMB FB-DIMM thermal sensor… No
Intel 5500/5520/X58 thermal sensor… No
VIA C7 thermal sensor… No
VIA Nano thermal sensor… No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): yes

………………
Display CPU temperature
You can view the temperature data with the following command:

[email protected]:~$ sensors
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1: +33.0°C

pch_skylake-virtual-0
Adapter: Virtual device
temp1: +38.5°C

BAT0-acpi-0
Adapter: ACPI interface
in0: +12.45 V

coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 1: +38.0°C (high = +100.0°C, crit = +100.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1: 0 RPM
temp1: +38.0°C
temp2: N/A
temp3: +0.0°C
temp4: +0.0°C
temp5: +0.0°C
temp6: +0.0°C
temp7: +0.0°C
temp8: +0.0°C

BAT1-acpi-0
Adapter: ACPI interface
in0: +12.49 V

acpitz-acpi-0
Adapter: ACPI interface
temp1: +38.0°C (crit = +128.0°C)
You can also use the watch command to watch in real time:

[email protected]:~$ watch sensors
Display the CPU temperature with the graphical tool Psensor
With Psensor, you can check the following:

Temperature of main board, CPU sensor and NVIDIA GPU
Hard drive temperature
Fan speed
Monitor CPU usage
The latest version of Psensor also provides an applet indicator for Ubuntu, making it easier to monitor hardware temperature on Ubuntu. You can choose to display the temperature in the top panel. It can even send desktop notifications when the temperature exceeds the limit.

We can install Psensor with the following command:

[email protected]:~/Desktop$ sudo apt install -y psensor
Open the launchpad of Ubuntu, find the Psensor in it, and open the application to see multiple sensors
How to get CPU temperature in Ubuntu Linux how to get CPU temperature in Ubuntu Linux
How to get CPU temperature in Ubuntu Linux how to get CPU temperature in Ubuntu Linux

Using graphical tool hardinfo
Hardinfo is a tool used in Linux to display hardware information in graphical interface. You can use it to detect the temperature of the CPU. Install hardinfo with the following command:

[email protected]:~/Desktop$ sudo apt install hardinfo

Run the command to open hardinfo

[email protected]:~/Desktop$ sudo hardinfo
How to get CPU temperature in Ubuntu Linux how to get CPU temperature in Ubuntu Linux

summary
In this tutorial, we will learn how to get the CPU temperature on Ubuntu Linux from the command line and desktop.