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.
In this context, we shall look into the installation & usages of llm_sensors and hddtemp packages to monitor CPU temperature on Ubuntu 20.04.
How to install lm_sensor and hddtemp packages on Ubuntu?
To begin, 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
How to Detect Hardware monitoring chips on Ubuntu ?
Here, 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.
Run the command:
$ /etc/init.d/kmod start
How to Check the CPU temperature on Ubuntu ?
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