CPUs have been notorious for generating a lot of heat. Even with modern insulation and cooling systems, they are among the hottest components of any computer system.
While idle CPUs are relatively cool, calculation-intensive workloads can significantly increase the operating temperature of the CPU block. Improper ventilation (mainly due to dust blocking the vents) also allows heat to build up and deteriorate the system’s performance.
Monitoring Linux CPU temperature in Ubuntu is an essential requirement for ensuring sustained performance. Consistent high temperatures can make sensitive system parts (especially CPU) wear out faster. As such, monitoring CPU temperature is important to avoid the system slowing down or damaging the parts.
In this guide, we will show you several ways of monitoring the CPU temperature on Linux systems.
Monitor CPU Temperature in Ubuntu and Linux Distributions
Before going into the details of the utilities and how you can use them to find out the CPU temperature, let’s discuss the prerequisites for using them.
The Prerequisites
- A system running Ubuntu or any other mainstream Linux distribution
- A user account with root or sudo privileges
Check CPU Temperature Using lm-sensors
lm-sensors is a suite of tools that helps watch over your computer’s hardware. You can use it to see how hot your CPU and other parts are running at a specific time.
Install lm-sensors
Let’s start with how you can set up the lm-sensors utility in your Ubuntu system:
Go to the terminal and use your package manager to install the relevant packages on your system.
On our test system running Ubuntu, we used the following command:
# sudo apt install hddtemp lm-sensors
Once the installation finishes, use the sensors command to check the CPU temperature. The results will display the current CPU temperatures of all the sensors in your computer, including each CPU core. You can also see the high and critical temperature limits for comparison.
Similarly, you can use the following command to see the temperatures of your SSD and hard drive:
# sudo hddtemp /dev/sda
Detect System Sensors
Modern hardware components usually have sensors to monitor performance parameters. You can run the following command to detect these sensors on your system:
# sudo sensors-detect.
Keep saying YES when it asks to scan until the system scan is done.
After the scan finishes, the utility will display a short summary of its findings.
We recommend running the following command to load essential modules for system monitoring functions:
# /etc/init.d/kmod start
If you want to keep checking the temperature continuously and see live data in the terminal, use this command:
# watch sensors
The result updates every two seconds and shows the current temperature of the CPU cores.
Check CPU Temperature Using Psensor
Psensor is a graphical application that helps you keep an eye on how hot different parts of your computer are running. It also lets you check how much your CPU is being used and how fast your fans are spinning.
For Ubuntu users, Psensor has a handy feature called an applet indicator. This puts the temperature right up in the top panel of your screen. It can alert you if things start getting too hot.
Install Psensor
Before using the utility, you have to install and configure it first.
Use this command to add the required packages:
# sudo apt install psensor
Say YES and wait for the installation to complete.
How to Use and Configure Psensor
Look for Psensor in the application menu and open it. The tool will show you a graph with information like Linux CPU temperature, CPU and memory usage, available RAM, GPU temperature, and HDD temperature.
You can choose what information you want to see by configuring the Psensor utility. For this, follow these steps:
Select Psensor from the menu bar, and then choose Preferences.
Tick the boxes for the choices you prefer to see, such as whether Psensor starts when the system boots up, the time between updates, and graph colors.
If you want to see CPU or HDD temperatures at the top of your screen, go to Sensors > Application Indicator. Turn on the Display sensor option for system components.
Check Temperature Without Third-Party Utilities
You can use the built-in tools to check the CPU temperature. For instance, you can run the following command to see the CPU temperature as measured by these native utilities:
# cat /sys/class/thermal/thermal_zone*/temp
The result displays the CPU temperature in a five-digit format. For example, 34000 indicates a CPU temperature of 34 degrees Celsius.
If you see multiple thermal zones and temperature readings, use this command to find out what each thermal zone represents:
# cat /sys/class/thermal/<thermal_zoneNumber>/type
For instance, use the command cat /sys/class/thermal/thermal_zone2/type to determine the type of thermal zone 2.
The CPU temperature is located in the zone marked as x86_pkg_temp.
To understand the meaning of all the thermal zones, use the following command:
# paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'
The result displays the temperature that was last recorded for that thermal zone in degrees Celsius. In this case, there’s only one thermal zone, named x86_pkg_temp, and it represents the CPU temperature.
Conclusion
Keeping an eye on your Linux machine’s CPU temperature is important for maintaining the health and performance of your computer. By using built-in tools like sensors and exploring applications like Psensor, you can easily monitor temperature levels and prevent any potential issues.
Experience hosting perfection with RedSwitches. We offer unparalleled dedicated hosting solutions for seamless performance and global reach. Our product lineup has the best dedicated server pricing for instant dedicated servers. These servers are usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.
FAQs
Q. What are some methods to monitor CPU temperature in Ubuntu Linux?
You can monitor CPU temperature in Ubuntu Linux using command line tools such as ‘sensors’ or ‘watch sensors’ for real-time monitoring. Additionally, there are various GUI tools available for monitoring CPU temperature in Ubuntu Linux.
Q. Are there any GUI tools available to monitor CPU temperature in Ubuntu Linux?
Yes, there are several GUI tools available to monitor CPU temperature in Ubuntu Linux, such as Psensor, CPU-G, or GKrellM. These tools provide a graphical interface for monitoring hardware sensors, including CPU temperature.
Q. How do I monitor CPU and GPU temperatures in Ubuntu Linux?
You can use the ‘watch sensors’ command in the terminal to continuously monitor CPU temperature in real-time on Ubuntu Linux. This command updates the temperature readings at regular intervals.
Q. What command line utility can I use to monitor CPU temperature on Ubuntu Linux?
You can use the ‘watch sensors’ command in the terminal to continuously monitor CPU temperature in real-time on Ubuntu Linux. This command updates the temperature readings at regular intervals.
Q. How can I understand CPU temperature readings on Ubuntu Linux?
CPU temperature readings on Ubuntu Linux can be understood by checking for values that indicate normal operating temperature and identifying any signs of overheating or excessive heat. Monitoring CPU temperature is important to prevent overheating and potential hardware failure.
Q. What are some common Linux distributions for monitoring CPU temperature?
Common Linux distributions for monitoring CPU temperature include Ubuntu, Fedora, Debian, and CentOS. These distributions provide command-line tools and GUI applications for monitoring hardware sensor chips, including CPU temperature.
Q. Can CPU temperature and fan speed be monitored in Ubuntu Linux?
You can monitor CPU temperature and fan speed in Ubuntu Linux using tools like Psensor or the ‘sensors’ command in the terminal, which provide real-time readings of hardware sensor data, including fan speed and CPU temperature.
Q. Can I monitor the hard disk drive temperature in Ubuntu Linux?
Yes, you can monitor hard disk drive temperature in Ubuntu Linux using tools like ‘hddtemp’, which provides temperature readings for hard disk drives in the system, allowing you to monitor and prevent overheating of storage devices.
Q. What are some ways to prevent CPU overheating in Ubuntu Linux?
To prevent CPU overheating in Ubuntu Linux, you can monitor CPU temperature using the command line or GUI tools, ensure proper ventilation and cooling of the system, and consider hardware upgrades or adjustments to prevent thermal throttling or damage due to excessive heat.