How to Check CPU Temperature on Linux?
Overview
An optimal CPU temperature is needed for maintaining the system health and performance of the Linux system. Therefore, checking the CPU temperature on a Linux system is important and overheating can lead to various issues such as system instability, reduced lifespan of components, and even permanent hardware damage. Monitoring the CPU temperature allows users to take proactive measures to prevent such problems. This article explores different methods to check the CPU temperature in a Linux system.
Introduction
Monitoring the CPU temperature in a Linux system is performed using Thermal Diodes and various Digital Thermal Sensors that are integrated into the motherboard or the CPU itself. Several tools and utilities are available on Linux systems that access these sensors to check and provide real-time readings of the CPU temperature in Linux. The temperature readings are typically provided in degrees Celsius (°C) or millidegrees Celsius (m°C). Let us explore these tools in the upcoming sections.
Check CPU Temperature Using Lm-Sensors
Lm-Sensor is a software package for Linux-based systems that are used to monitor various hardware sensors and retrieve various sensor data on temperature, voltages, and fan speeds. Lm-sensors work by interacting with the kernel modules and drivers that communicate with the hardware sensors.
Follow the steps below to install and find the CPU temperature of linux using Lm-sensors:
- Open a terminal window on your Linux system.
- Use the apt pacakge manager to downlaod the lm-sensors pacakge.
If you are facing any error in the above command, run the following commands to resolve it in most cases.
We can also use other package managers like yum and pacman based on your Linux distro to install the package.
-
After installation of the lm-sensors package, we can use the sensors-detect command to detect and configure the hardware sensors present in a Linux system.
The command is used to configure the correct driver used to communicate with the sensors for accessing the sensor data.

- The command will prompt you for permission to probe different sensors. Press Enter to accept the default options for most cases.
- At the end of the detection process, sensors-detect will ask whether to add the detected modules to the /etc/modules file. Type "yes" to proceed.
This command generates a configuration file, /etc/modules, which contains the detected modules that are to be loaded during system startup to get sensor data.
- Reboot your system for the changes to take effect.
- Check the CPU temperature of linux using the following command,
The following output will be displayed and has information regarding various sensor readings, including the CPU temperature.
-
The acpitz-virtual-0 represents a virtual device and coretemp-isa-0000 is an ISA adapter representing the CPU's cores. nvme-pci-0100 and k10temp-pci-00c3 are PCI adapters.
-
The crit value indicates the critical temperature threshold at which overheating may occur.
-
The high value indicates the high-temperature threshold for each sensor respectively.
We can also watch the sensor's output continuously using the watch sensors command which updates the data of sensors every 2 seconds.
We can use the hddtemp to monitor the temperature of hard disk drives and SSD in a Linux system. The command can be used as,
-
We can also configure alerts and notifications based on temperature thresholds.
-
The hddtemp package is not available on Ubuntu 22.04 LTS, but you can use the modprobe command along with the sensors command to check the hard disk and SSD temperature.
Check CPU Temperature Using Psensor
Another user-friendly option for monitoring CPU temperature on Linux is Psensor. It provides a graphical interface and real-time monitoring capabilities to find the CPU temperature of linux. Here's how to install and use Psensor,
Install Psensor
-
Open a terminal window.
-
Enter the following command to install the psensor package.
Using Psensor
Once installed, launch Psensor from the application menu to find the CPU temperature of linux.

- The main Psensor window will display temperature readings for different hardware components, including the CPU.
- Click on the Psensor button on the top-right to open the menu and click on Preferences to customize the display, configure alarms, and monitor real-time temperature fluctuations using the Psensor interface.

Check Temperature Without Third-Party Utilities
We can also check the CPU temperature of linux without relying on third-party utilities by using the information in the sys/class/thermal directory.
-
The sys/class/ directory is a virtual filesystem that provides a hierarchical representation of different device classes and their attributes.
-
The sys/class/thermal directory has information regarding the thermal zones where temperature sensors are in the system.
-
A thermal zone directory has important files such as,
- The temp file contains the current temperature reading of the thermal zone in millidegrees Celsius (m°C).
- The type file contains a description or name of the thermal zone.
- The trip*point files represent trip points or thresholds defined for the thermal zone.
We can utilize the cat command to display the CPU temperature of linux in the file. The following command is used to display the temperature,
The sample output given below displays the temperature readings in millidegrees Celsius (m°C) for different thermal zones. The zone containing the CPU temperature has also been indicated.
After converting the millidegrees Celsius to Celsius, we get the temperature thermal_zone0 as 30°C and thermal_zone1 as 28°. To get both the name stored in type and temperature in temp as Celsius, we can use the following command,
Let us understand how this command works,
- The cat command inside brackets is used to retrieve the contents of the type and temp files.
- The <(...) syntax is known as process substitution and it is used to treat the output of the cat command as an input stream. This input is provided to the paste command
- The paste command combines the contents of two input sources side by side.
- The column command formats the input into columns. The -s $'\t' option sets the column delimiter to a tab character, and -t performs table formatting by adjusting the width of each column based on the content.
- The sed command is used for text substitution and replaces the last two characters of each line with a dot followed by the first character and the degree Celsius symbol. This formatting ensures that the temperature values are displayed in the desired format (e.g., 50°C).
Conclusion
- Monitoring the CPU temperature on Linux is essential for maintaining system stability and preventing hardware damage.
- The Lm-sensors package can be used to monitor various hardware sensors and CPU temperature in Linux through the command line.
- We can also use the hddtemp package to monitor HDD and SDD temperatures.
- Psensor provides a graphical interface for monitoring the CPU temperature of Linux in real-time.
- Linux also stores its CPU temperature information in files and we can use the required commands to view the stored CPU temperature of linux.
- Regularly checking and monitoring the CPU temperature will help ensure optimal performance and longevity of your system.