Is it hot in here?

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
3,319
Reaction score
3,054
Credits
29,529
Monitoring Hardware Temperatures in Linux
Monitoring the temperature of your hardware components is crucial for maintaining system health and performance. In this article, we'll cover how to use lm_sensors, hddtemp, nvidia-smi, and inxi to get temperature readings for various hardware devices in Linux.

1. lm_sensors​

lm_sensors is a widely used tool for monitoring CPU, motherboard, and other system sensors.

Installing lm_sensors​

On Debian-based systems:

Code:
 sudo apt install lm-sensors

On RPM-based systems:

Code:
 sudo dnf install lm_sensors

Detecting Hardware Sensors​

To detect hardware sensors, run the following command:

Code:
 sudo sensors-detect

Follow the prompts to scan for various hardware sensors. It's generally safe to accept the default answers by pressing Enter.

Displaying Sensor Readings​

To display sensor readings, use the sensors command:

Code:
 sensors

To display temperatures in Fahrenheit, use the -f flag:

Code:
 sensors -f

2. hddtemp​

hddtemp is used to monitor the temperature of hard drives, including SSDs and NVMe drives.

Installing hddtemp​

On Debian-based systems:

Code:
 sudo apt install hddtemp

On RPM-based systems:

Code:
 sudo dnf install hddtemp

Displaying Hard Drive Temperature​

To check the temperature of a specific drive, use:

Code:
 sudo hddtemp /dev/sdX

Replace /dev/sdX with the appropriate device identifier. If you don't specify a device, hddtemp will show the temperatures of all detected drives:

Code:
 sudo hddtemp

3. nvidia-smi​

nvidia-smi is a tool specifically for NVIDIA GPUs and provides detailed information about GPU temperature, usage, and other metrics. Note that nvidia-smi is part of the nvidia-cuda package on RPM-based systems and only works with NVIDIA cards.

Installing nvidia-smi​

On Debian-based systems:

Code:
 sudo apt install nvidia-smi

On RPM-based systems:

Code:
 sudo dnf install xorg-x11-drv-nvidia-cuda

Displaying GPU Temperature​

To display GPU temperature, use:

Code:
 nvidia-smi --query-gpu=name,temperature.gpu --format=csv,noheader

4. inxi​

inxi is a powerful system information script that can display various hardware details, including temperatures.

Installing inxi​

On Debian-based systems:

Code:
 sudo apt install inxi

On RPM-based systems:

Code:
 sudo dnf install inxi

Displaying Temperature Information​

To display temperature information, use:

Code:
 inxi -s

To force inxi to show temperatures in Fahrenheit, use:

Code:
 inxi -sxx

Alternatively, you can create or edit the ~/.inxi/config file and add the following line to make this change permanent:

Code:
 TemperatureUnit = fahrenheit
 
Last edited:


Thanks for the rundown on the temps, sometimes very important on heavy use machines.

Unfortunately hddtemp doesn't appear to be available in the repos for more current debian:
Code:
You have searched for packages that names contain hddtemp in all suites, all sections, and all architectures. Found 1 matching packages.
Exact hits
Package hddtemp

    buster (oldoldstable) (utils): hard drive temperature monitoring utility
    0.3-beta15-53: amd64 arm64 armhf i386
    bullseye (oldstable) (utils): hard drive temperature monitoring utility
    0.3-beta15-54: amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x

Also unfortunately, the nvidia-smi, I found, won't work for the nouveau driver on nvidia cards, but only if one has loaded the nvidia driver software.

Nevertheless, lm-sensors is "old reliable" :)
 
For hard drives.

root@absTower:~# smartctl -a /dev/nvme0n1 | grep -i Temper
Temperature: 44 Celsius
Warning Comp. Temperature Time: 0
Critical Comp. Temperature Time: 0

root@absTower:~# smartctl -x /dev/sda | grep -i Temper
194 Temperature_Celsius PO---K 067 050 000 - 33 (Min/Max 17/50)
0x05 ===== = = === == Temperature Statistics (rev 1) ==
0x05 0x008 1 33 --- Current Temperature
0x05 0x020 1 50 --- Highest Temperature
0x05 0x028 1 17 --- Lowest Temperature
 
For Intel CPU I use pcm https://github.com/intel/pcm

There is a catch, you have to know TJ temp for your CPU and subtract reported value from TJ to get temp in celsius.
The package is available from distro repo ofc. for most distros.

Example from terminal:

Screenshot_20250114_165132.png


Reported temp is 69, and TJ is 100C for my CPU, so the actual temp is 100 - 69 = 31C
 


Top