Methods of payment Abuse

How to view and monitor Linux temperature

08.03.2021, 21:58

Do you often have to worry about the temperature of your computer? Probably not if the machine is in good working order and running smoothly. The temperature will not rise above the maximum value set by the manufacturer if there are no factory defects. However, still, overheating can occur, not only because of a hardware problem, but also as a result of a failure in the graphics card driver or an incorrectly configured program to control the cooling system. Often the cause of overheating lies in the accumulation of dust and dirt, which prevents normal system cooling and heat dissipation. This is usually seen on older machines.

It is worth realizing that overheating can lead to quite unpleasant consequences. Be sure to keep an eye on the state of your computer system. It is especially useful if there is a service that monitors the temperature value and notifies the user if it rises. In this instruction we will consider how to see the temperature value and organize a monitoring system. Linux has a special set of tools designed for this task.

What is needed

So, to accomplish the task at hand, you will need the following standard tools:

  • lm-sensors - extracts data from hardware sensors on the motherboard to monitor temperature, voltage.
  • hddtemp - measures the temperature of hard disks.
  • psensor - a graphical temperature monitoring utility that allows you to see the temperature of Linux, for CPU, graphics card, hard disks.

Our next task is to install the components.

Installing the components

Since lm-sensors works based on the information provided by lm-sensors and hddtemp, it is these components that need to be installed first. To do this, run the following command:

$ sudo apt install lm-sensors hddtemp psensor

If you need the most up-to-date version of these components, then the command should be slightly modified:

$ sudo add-apt-repository ppa:jfi/ppa

sudo apt update

sudo apt install lm-sensors hddtemp psensor

That is, you need to add the developer PPA to the system.

Installing psensor in Fedora and other Red Hat-based distributions looks something like this:

$ sudo yum install lm_sensors hddtemp psensor

Configuring temperature monitoring

First of all, configure the low-level tools designed to read information, which include lm_sensors and hddtemp. By installing them, you can provide the system with temperature monitoring:

$ sudo sensors-detect

This command starts the ls_sensors configuration wizard. The user should answer all questions with Y. Next, it will detect the built-in hardware sensors on the system, and automatically detect the appropriate drivers.

Once the sensor scan is complete, the user will be prompted to add the detected kernel modules to the autoloader:

In Ubuntu or Debian, the modules will be added to /etc/modeuls. To automatically load the required modules, just add lm_sensors to autoload:

$ sudo systemctl enable lm-sensors

Next, we can see the temperature of the CPU and other hardware components using the following command:

$ sensors

Configuring DDTEMP

To start monitoring the temperature of hard disks we need to run hddtemp as a daemon, replace /dev/sda with the address of your disk:

$ sudo hddtemp -d /dev/sda

Repeat this operation for each system disk. Another important nuance is that the program should be added to the autoload list.

Measuring and monitoring temperatures

You can also monitor the temperature in Linux using psensor - a special graphical utility. You can run it either by command or from the main menu of the system. The command is run as follows:

$ psensors

In the main window of the program and select Options. A list of sensors displaying the temperatures of the main components will open in front of you. You can choose for yourself which of the sensors to follow.

To set an alarm for a particular sensor, click on the Alarm tab. By default, temperature in psensor is measured in degrees Celsius. Recent versions also support conversion to degrees Fahrenheit.

That's it, the temperature of your computer's most important components will now always be under your control. Be sure to add it to your autoloader to ensure you can work with it.