Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Friday, May 31, 2024 at 21:52

This tutorial will show you a simple way how to show temperature and fan speed on an Ubuntu 24.04 laptop. This is extremely useful especially when your laptop tends to be hot and you live at a hot place. We use ThinkPad T430 as example for this tutorial and your results should be more or less the same. Now let's learn how to do that!


Subscribe to UbuntuBuzz Telegram Channel to get article updates.

Install the Requirements

Run Terminal and write this command line $ sudo apt-get install lm-sensors  followed by Enter.


Show Temperature and Fan Speed 

Run Terminal and try one command line below.

Command line:

$ while true; do sensors | egrep '(fan1|Core|temp1)'; sleep 1; echo "==========="; done

 

Output sample:

Core 0:        +61.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1: +59.0°C (high = +87.0°C, crit = +105.0°C)
fan1: 2533 RPM
temp1: +59.0°C


 

Meaning:

Output above means more or less that our laptop temperature (or more precisely our CPU) is around 59-61 °C currently while our fan spins at 2533 rotation per minute. That's normal. The additional information there means that on ThinkPad, 87 °C is considered high temperature (so user must be aware of) and 105 °C is considered critical or very dangerous to the laptop (it can cause your laptop to break).


Picture sample:


Explanation:

while true; is a command to loop/repeat indefinitely any command after it.

do ...; done is a command that is part of while loop where any command inside it (...) will be looped/repeated.

sensors is the actual command to show all information about temperature and fan speed in a listing format.

pipeline character ( | ) is a connector so that output from a command becomes input for next command.

egrep is a filter/search that is capable to find more than one keyword at once.

'(fan1|Core|temp1)' is the argument to egrep that forms a command to show only fan1 and Core and temp1 by removing any other text from the output.

sleep 1; is the command to give delay by one second for the looping.

echo "===========" is the command to draw simple line and newline to every output.

lm-sensors is the package that contains sensors command below. 


****



This article is licensed under CC BY-SA 3.0.