Overheating of laptops is a common issue one faces these days. Monitoring hardware temperature may help you to diagnose why laptop is getting overheated.
In this article, we will share some useful command-line tools to help you keep a close eye on the temperature of your CPU and GPU.

Sensors

Sensors is a simple command-line utility that displays the current readings of all sensor chips including the CPU. It comes pre-installed some Linux distributions such as Ubuntu by default, otherwise install it as shown.

$ sudo apt-get install lm-sensors

Then you can run the following command to detect all sensors on your system.

$ sudo sensors-detect

Example output:

$ sudo sensors-detect 
# sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)
# System: Hewlett-Packard HP EliteBook Folio 9470m [A1029D1103] (laptop)
# Board: Hewlett-Packard 18DF
# Kernel: 5.3.0-28-generic x86_64
# Processor: Intel(R) Core(TM) i7-3687U CPU @ 2.10GHz (6/58/9)

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
Module cpuid loaded successfully.
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 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
...............

Once detected, you can run the following command to check CPU temperature, GPU temperature, fan speed, voltage, etc.

$ sensors


Example Output:

$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +57.0°C  (high = +87.0°C, crit = +105.0°C)
Core 0:        +56.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:        +57.0°C  (high = +87.0°C, crit = +105.0°C)

2. Glances

Glances is a cross-platform curses-based system monitoring tool written in Python. It uses the psutil library to retrieve information from your system.
It’s accommodating all in one place, It shows a maximum information in a minimal space through curses or a web-based interface.
The information dynamically adapts depending on the size of the user interface.
Glances is capable to monitor CPU usage, Memory usage, Swap usage, System Load Average, Process list, Network interface, Disk I/O, Raid, Sensors (CPU temperature), Battery, Filesystem Usage, Docker, Monitor, Alert, System info, Uptime, etc…
To install Glances on your system, use next command:

$ sudo apt install glances -y

Once you have installed it, start Glances and press f key to view sensors information.

$ glances

Example output:

Glances – Monitor CPU and GPU Temperature

Glances – Monitor CPU and GPU Temperature

3. i7z

The i7z is a tool that reports the Intel Core i7, i5 and i3 CPU information about Turbo boost, per CPU frequencies, multipliers, temperature as well as the times spent in the C-state in real time.
You can install it on your Ubuntu system by running the following command.

$ sudo apt install i7z -y

Once installed, run i7z with root privileges as shown.

$ sudo i7z


Example output:

Show Intel Core Information with Temperature

Show Intel Core Information with Temperature

That’s all for now! In this article, we have shared the useful command-line tools for viewing CPU and GPU temperatures in a Ubuntu system. Have your say about this article or ask questions via the feedback form below.