Monitoring the CPU temperature on RHEL/CentOS systems is crucial for ensuring the optimal performance and longevity of your hardware. Overheating can lead to thermal throttling, reduced lifespan of components, or even system crashes. In this guide, we will explore several methods to monitor CPU temperature, providing you with the tools to keep your system cool and running smoothly.
In this tutorial you will learn:
- How to use the lm_sensors package to monitor CPU temperature
- How to use the hddtemp command to check hard drive temperatures
- How to utilize the psensor graphical interface for temperature monitoring
- How to read temperature information directly from sysfs
- How to use the Glances tool for comprehensive system monitoring
- How to you cron to monitor CPU temperature with Bash Script

| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | RHEL/CentOS 7 or higher |
| Software | lm_sensors, hddtemp, psensor, sysfs, Glances |
| Other | Internet connection for installing packages |
| Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to Monitor CPU Temperature on RHEL/CentOS
Monitoring CPU temperature is a straightforward process on RHEL/CentOS systems. Several tools are available, ranging from command-line utilities to graphical applications. Below are five different methods to check and monitor your CPU temperature.
- Using lm_sensors: The lm_sensors package provides essential tools for monitoring temperatures, voltages, and fans.
# dnf install lm_sensors # sensors-detect # sensors | grep Core
After installing lm_sensors, run
sensors-detectto identify the sensors on your system. Once detected, use thesensorscommand to display temperature readings.
Monitor CPU Temperature with sensors - Using psensor: Psensor is a graphical temperature monitoring tool that shows temperatures in a user-friendly interface.
# dnf install psensor $ psensor
Psensor requires lm_sensors to be installed. Launch the psensor application to view real-time temperature data.

Monitor CPU Temperature with psensor - Reading temperature from sysfs: Sysfs provides a simple way to access temperature data directly from the filesystem.
# cat /sys/class/thermal/thermal_zone0/temp
This command reads the temperature directly from the thermal zone interface. The temperature is usually reported in millidegrees Celsius, so divide the result by 1000 to get the value in degrees Celsius.
- Using Glances: Glances is a cross-platform monitoring tool that provides detailed system information, including temperature.
# dnf install glances # glances
Glances combines various system monitoring tools and presents the data in a comprehensive way. Use it to monitor CPU temperature alongside other system metrics.
Automating CPU Temperature Monitoring with a Bash Script
Monitoring CPU temperature manually can be cumbersome, especially if you need to check it regularly. Automating this task with a bash script and using cron to schedule it is a convenient solution.
Bash Script for Monitoring CPU Temperature
Below is a basic bash script that logs the CPU temperature to a file. The script uses the lm_sensors output to get the temperature reading.
#!/bin/bash
# Log file path
LOG_FILE="/var/log/cpu_temp.log"
# Get CPU temperature
TEMP=$(sensors | grep 'Core 0' | awk '{print $3}')
# Get current date and time
DATE=$(date '+%Y-%m-%d %H:%M:%S')
# Write to log file
echo "$DATE - CPU Temperature: $TEMP" >> $LOG_FILE
Save this script as monitor_cpu_temp.sh and make it executable:
# chmod +x /path/to/monitor_cpu_temp.sh
Scheduling the Script with Cron
To automate the script, use cron to schedule it at regular intervals. For example, to run the script every hour, add the following line to your crontab file:
0 * * * * /path/to/monitor_cpu_temp.sh
Edit the crontab file using:
# crontab -e
Add the above cron job line, save the file, and exit. The script will now run every hour and log the CPU temperature to /var/log/cpu_temp.log.
This automated approach ensures continuous monitoring of your CPU temperature without manual intervention.
Conclusion
By utilizing these tools, you can effectively monitor and manage the CPU temperature on your RHEL/CentOS system. Regular monitoring helps prevent overheating and ensures your system runs efficiently. Whether you prefer command-line utilities or graphical tools, there is a method suited to your needs.