Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to Check CPU Temperature on Linux?
Monitoring CPU temperature on a Linux system is essential for maintaining optimal performance and preventing hardware damage. The CPU generates heat as it processes data, and excessive heat can cause system instability, thermal throttling, or permanent hardware failure.
This guide covers various methods to check CPU temperature on Linux using both command-line and graphical tools.
Understanding CPU Temperature Monitoring
CPU temperature is measured in degrees Celsius and indicates how hot the processor is running. When temperatures exceed safe limits (typically 70-80°C for most CPUs), the processor may throttle its speed to reduce heat generation, resulting in decreased performance.
Linux uses hardware sensors to monitor temperature:
CPU thermal sensors Built into the processor to measure core temperatures
Motherboard sensors Monitor ambient temperatures and cooling fan speeds
Command-Line Tools
Installing lm-sensors
The lm-sensors package is the most popular tool for hardware monitoring on Linux. Install it using your distribution's package manager:
# Ubuntu/Debian sudo apt install lm-sensors # Fedora/RHEL sudo dnf install lm_sensors # Arch Linux sudo pacman -S lm_sensors
Detecting and Configuring Sensors
After installation, detect available sensors:
sudo sensors-detect
This interactive script will scan for hardware sensors and configure them automatically. Answer "yes" to most questions for comprehensive detection.
Viewing Temperature Data
Use the sensors command to display current temperature readings:
sensors
coretemp-isa-0000 Adapter: ISA adapter Package id 0: +42.0°C (high = +84.0°C, crit = +100.0°C) Core 0: +39.0°C (high = +84.0°C, crit = +100.0°C) Core 1: +41.0°C (high = +84.0°C, crit = +100.0°C) Core 2: +42.0°C (high = +84.0°C, crit = +100.0°C) Core 3: +40.0°C (high = +84.0°C, crit = +100.0°C)
Alternative Tools
For specific monitoring needs, consider these additional tools:
# Check hard drive temperature sudo apt install hddtemp sudo hddtemp /dev/sda # Real-time temperature monitoring watch -n 2 sensors
GUI Tools
Psensor
Psensor provides a graphical interface with real-time graphs and temperature alerts:
sudo apt install psensor
Launch psensor from the applications menu to view temperature graphs and configure alerts.
Desktop Environment Integration
Install sensors applets for your desktop environment:
# GNOME sudo apt install sensors-applet # KDE Plasma (usually pre-installed) # Available through System Monitor widget # XFCE sudo apt install xfce4-sensors-plugin
Advanced Monitoring Techniques
Setting Temperature Alerts
Configure email alerts when temperatures exceed thresholds using sensord:
sudo apt install sensord sudo systemctl enable sensord sudo systemctl start sensord
Logging Temperature Data
Create a script to log temperature data over time:
#!/bin/bash
# Save as temp_logger.sh
while true; do
echo "$(date): $(sensors | grep 'Package id 0' | awk '{print $4}')" >> /tmp/cpu_temp.log
sleep 60
done
Continuous Monitoring
| Tool | Best For | Features |
|---|---|---|
| sensors | Quick checks | Command-line, instant readings |
| psensor | Real-time monitoring | Graphs, alerts, system tray |
| watch sensors | Terminal monitoring | Auto-refreshing display |
| Desktop widgets | Always-visible monitoring | Integrated with desktop |
Troubleshooting High Temperatures
If temperatures consistently exceed 70°C under normal load:
Clean dust from CPU cooler and case fans
Verify thermal paste application on CPU
Check that all cooling fans are functioning
Ensure adequate case ventilation
Consider upgrading CPU cooler for high-performance systems
Conclusion
Regular CPU temperature monitoring is crucial for system stability and longevity. The lm-sensors package provides comprehensive command-line monitoring, while GUI tools like psensor offer user-friendly interfaces with alerts and graphing capabilities. Implementing proper temperature monitoring helps prevent thermal throttling and hardware damage, ensuring optimal system performance.
