Monitoring CPU temperature in Linux reduces the risk of thermal throttling, sudden reboots, and long-term hardware damage. Keeping temperature under control helps maintain predictable performance, especially during compiling, gaming, or heavy virtualization workloads where sustained CPU usage is common.
CPU sensors are typically exposed via kernel drivers that read on-die digital temperature sensors and expose them through interfaces such as /sys/class/thermal and the hwmon subsystem. User-space tools like lm-sensors read these values and present them in a human-readable format, grouped by chips, adapters, and sensor labels such as Package id 0 or Core 0.
Access to low-level sensor buses may require elevated privileges, and some older or exotic hardware can expose incomplete or misleading readings. Careful interpretation of values, awareness of the vendor’s maximum recommended temperatures, and avoidance of aggressive probing on fragile systems all help prevent misconfiguration or unnecessary alarm.
Steps to monitor CPU temperature using lm-sensors:
- Open a terminal on the system where CPU temperature requires monitoring.
- Refresh package metadata before installing sensor tools.
$ sudo apt update Hit:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease Hit:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease Hit:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease Hit:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease Reading package lists... Building dependency tree... Reading state information... 5 packages can be upgraded. Run 'apt list --upgradable' to see them.
- Install the lm-sensors package on a Debian-based system.
$ sudo apt install --assume-yes lm-sensors Reading package lists... Building dependency tree... Reading state information... lm-sensors is already the newest version (1:3.6.0-9build1). 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
On RHEL or Fedora, the package is typically named lm_sensors and installed with dnf, while openSUSE systems use zypper to install the same toolset.
- Probe for available hardware sensors using sensors-detect.
$ sudo sensors-detect --auto No i2c device files found.
In containers or minimal VMs, the probe may report no sensor buses; run the scan on physical hardware to load sensor drivers.
- Display current temperature readings with the sensors command.
$ sensors No sensors found! Make sure you loaded all the kernel drivers you need. Try sensors-detect to find out which these are.
Names such as Package id 0 usually refer to the overall CPU package, while entries labeled Core N represent individual cores.
- Show only CPU-core temperatures using grep on sensors output when a concise view is preferred.
$ sensors | grep -i 'core' No sensors found! Make sure you loaded all the kernel drivers you need. Try sensors-detect to find out which these are.
- Confirm successful monitoring by observing lower temperatures at idle and higher temperatures during normal workload periods in repeated sensors readings (or by running watch -n 2 sensors for continuous updates).
Consistently high readings near or above the vendor’s specified crit temperature indicate inadequate cooling and can lead to throttling, instability, or hardware failure.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
