High CPU temperatures account for one of the many risk factors that can adversely impact your PC. Overheating can slow down your PC, and significantly slow down applications and processes. In critical scenarios, the PC shuts down to mitigate any further risks such as destruction of the motherboard components.
As such, constant monitoring is a priority especially if you are running an old PC or a PC with inadequate ventilation. In Linux, you can monitor the temperature of your hardware components using the lm_sensors and hddtemp packages
This guide walks you through the installation & usages of llm_sensors and hddtemp packages to monitor CPU temperature. For demonstration, we will use Ubuntu 20.04.
How to install lm_sensor and hddtemp packages
To start off, update the package lists on your system as follows.
$ sudo apt update
Next, install the sensor packages as follows:
$ sudo apt install hddtemp lm-sensors
Detect Hardware monitoring chips
Next, we need to detect which system components we can monitor in our machines. To detect laptop hardware sensors run the command:
$ sudo sensors-detect
Type ‘Yes’ for all the scanning prompts until the system scan is complete.
Once the scanning is completed, we can see the summary of the process. There is a disclaimer to load the needed modules for monitoring programs.
Now, we need to load the modules needed to ensure that the system monitoring works.
$ /etc/init.d/kmod start
Checking the CPU temperature
Now, to check the temperature of various devices including the CPU cores and other adapters, run the sensors command as shown.
The output above shows the temperature of all the various hardware components.
We can also display the temperature of the hard drive using the hddtemp command. To do so, execute the command:
$ sudo hddtemp /dev/sda
Finally to get real-time monitoring data in the terminal, run the command:
$ watch sensors
That was a summary of how you can monitor the temperature of your CPU cores, hard drive and other components attached to the motherboard. In case your PC is overheating, consider disassembling your PC and blowing it with a blower to get rid of all the dust which might be blocking the ventilation vents. Also, ensure your laptop is placed on a hard surface and not on a cushy surface such as on a bed where the vents can easily get blocked. Lastly, enable power saving mode and close any unnecessary applications.