In this article, we cover how to monitor CPU temperature in Ubuntu through lm-sensors package. The same package can also be used to monitor voltage, fan speed etc. It is quite a useful tool to monitor the health of our hardware.
A process needs system resources to perform a task. Certain processes may require resources which are more than what our system can offer. This results in critical errors leading to system shutdown. Definitely not something we want. So, it is always better to monitor our hardware health at regular intervals.
If you identify that a process is consuming more that what our system can handle then, we can limit CPU usage of the process in Ubuntu.
Although, the package lm-sensors is installed as default in Ubuntu distribution. Still, we cover the installation steps for those who don’t have the package for some reason.
Note: Following operations would require you to have superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.
Install lm-sensors in Ubuntu
Since the package is already available through standard Ubuntu repository. Therefore, we update the repository first. This is just to make sure we get to have the latest version of the package. Hence, open a terminal and issue the following –
sudo apt update
Next, to install lm-sensors –
sudo apt install lm-sensors
Monitor CPU temperature in Ubuntu through lm-sensors
We need to first make sure that lm-sensors detects the hardware. Therefore in the terminal itself, issue the following –
sudo sensors-detect
Herein, the utility would ask you a few questions. Follow the instructions provided and act accordingly. Once it detects the necessary hardware, we move ahead to check CPU temperature.
sensors
It would return with current, high and critical CPU temperature among other things. Since, the output we get is hardware configuration specific. So, there is nothing common here. It would be different for different users.
In conclusion, we have covered how to monitor CPU temperature in Ubuntu through lm-sensors here.
Additional Info –
The output we get from the above command sensors
is in Celsius. But, if we want to check the CPU temperature in Fahrenheit then,
sensors -f