How to Check CPU Temperature on Linux

Introduction

If you are a Linux user, you may be wondering how to check your CPU temperature. This is an important task to do, as it can help you identify potential problems with your system. In this guide, we will show you how to check your CPU temperature on Linux. We will cover both the command line and graphical methods, so you can choose the one that best suits your needs. We will also discuss some of the best tools available for monitoring your CPU temperature.

How to Check CPU Temperature on Linux

1. Install lm-sensors

The first step to check your CPU temperature on Linux is to install lm-sensors. This is a command-line tool that can be used to monitor the temperature of your CPU. To install lm-sensors, open a terminal window and type:

sudo apt-get install lm-sensors

2. Run sensors-detect

Once lm-sensors is installed, you need to run the sensors-detect command. This will detect the sensors on your system and create a configuration file. To run sensors-detect, type:

sudo sensors-detect

3. Check the temperature

Once the configuration file is created, you can check the temperature of your CPU by typing:

sensors

This will display the temperature of your CPU in Celsius.

Introduction

Like any electrical component, CPUs generate heat when being used. Some resource-demanding programs cause the CPU to increase the clock speed, which results in higher temperatures. Dust buildup also causes the CPU to overheat.

High temperatures shorten the lifespan of sensitive components, so keeping track of CPU temperatures is crucial. This way, you prevent performance throttling or component damage.

In this tutorial, you will learn how to use different tools and in-built utilities to check CPU temperature on Linux machines.

How to Check CPU Temperature on Linux

Prerequisites

  • A machine running Linux
  • An account with sudo/root privileges

Check CPU Temperature Using Lm-Sensors

Lm-sensors is a command-line utility for hardware monitoring. Use the tool to check the temperature of the CPU and other components. Follow these steps to install and configure Lm-sensors:

1. Open the terminal and install these packages using a package manager for your distribution. In Ubuntu, use the following command:

sudo apt install hddtemp lm-sensors

Wait for the lm-sensors and hddtemp to finish downloading and installing.

2. Execute the sensors command to see the CPU temperature. The output shows the current temperature readings of all sensors in the machine. The results include the temperature of each core and maximum thresholds.

Sensors command output on Linux Ubuntu.

3. To check SSD and hard drive temperatures, execute the following command:

sudo hddtemp /dev/sda
Check hard drive temperature on Linux Ubuntu.

The output shows the temperature of the selected disk.

4. To see which system components you can monitor, run sudo sensors-detect.

Answer YES to multiple scanning requests until the system scan is complete.

Output showing a summary of sensors detected on Ubuntu.

When the scan completes, the output shows the summary.

5. To ensure that system monitoring works, load the needed modules using the following command:

/etc/init.d/kmod start
Start kmod service on Ubuntu to monitor hardware temperature.

6. To run the sensors command repeatedly and get real-time data in the terminal, execute the following command:

watch sensors
Real-time output in terminal showing CPU temperature on Ubuntu.

The output refreshes every two seconds and displays the current CPU temperature reading.

Check CPU Temperature Using Psensor

Psensor is a GUI app that allows you to monitor the temperature of various system components. This utility also allows you to monitor CPU usage and fan speed.

Psensor includes an applet indicator for Ubuntu, allowing you to display the temperature in the top panel to notify you when the temperatures get too high.

Install Psensor

Before installing Psensor, you need to install and configure Lm-sensors.

1. Run this command to install the necessary packages:

sudo apt install lm-sensors hddtemp

2. Next, scan for sensors in your machine:

sudo sensors-detect

Answer YES to any scan requests until the scan is completed.

3. To make sure the packages are installed, execute the sensors command.

Sensors command output on Linux Ubuntu.

4. Update the package repository with sudo apt update.

5. Install Psensor using the following command:

sudo apt install psensor
Install Psensor app on Ubuntu Linux.

Answer YES and wait for the installation to finish.

Using Psensor

Search for Psensor in the app menu and open the utility. The app displays a graph of the selected values and shows the CPU temperature, CPU and memory usage, free RAM, GPU temperature, and HDD temperature.

Psensor app on Ubuntu showing hardware temperatures.

To configure Psensor and set which stats you want to see, follow these steps:

1. Click Psensor in the menu bar, followed by Preferences.

2. Check off the boxes for the options you want – whether Psensor launches on system startup, the update interval, graph colors, etc.

Psensor app Preferences on Ubuntu Linux.

3. To show CPU or HDD temperatures in the top panel, go to Sensor Preferences under the Application Indicator. Enable the Display sensor in the label option.

Display sensor output in the top label in Ubuntu.

Note: Learn more about monitoring CPU performance by referring to our article on Linux perf, a lightweight command-line utility.

Check Temperature Without Third-Party Utilities

There is a way to use the in-built utilities to check the CPU temperature if you don’t want to use third-party apps.

1. To check the CPU temperature without installing a third-party app, use the following command:

cat /sys/class/thermal/thermal_zone*/temp
Display CPU temperature in Ubuntu without third-party apps.

The output shows the CPU temperature in the five-digit format. Here, 49000 means 49C.

2. If you get several thermal zones and different temperatures, execute the following command to see what a single thermal zone represents:

cat /sys/class/thermal/<thermal_zoneNumber>/type

For example, run cat /sys/class/thermal/thermal_zone2/type to see the type of thermal zone 2.

The CPU temperature is in the zone labeled x86_pkg_temp.

3. To see what all the thermal zones are referring to, use:

paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'
Display CPU temperature in Ubuntu without third-party apps.

The output shows the last stored temperature for that thermal zone in degrees Celsius. In this example, there is only one thermal zone, labeled x86_pkg_temp, which represents the CPU temperature.

Conclusion

You now know how to check CPU temperature on Linux using various utilities. The guide also showed how to configure the tools to display other information, such as GPU and HDD temperature.

How to Check CPU Temperature on Linux

If you’re a Linux user, you may be wondering how to check your CPU temperature. Fortunately, there are several ways to do this. In this article, we’ll discuss the different methods you can use to check your CPU temperature on Linux.

Using the Terminal

The easiest way to check your CPU temperature on Linux is to use the terminal. To do this, open a terminal window and type the following command:

sensors

This command will display the temperature of your CPU, as well as other system components. If you want to get more detailed information, you can use the following command:

sensors -u

This command will display the temperature of each individual core of your CPU. You can also use the following command to get more detailed information about your CPU temperature:

sensors -A

Using a GUI Tool

If you prefer a graphical user interface (GUI) tool, there are several available. One of the most popular is Psensor. To install Psensor, open a terminal window and type the following command:

sudo apt-get install psensor

Once Psensor is installed, you can launch it from the Applications menu. Psensor will display the temperature of your CPU, as well as other system components. You can also use Psensor to set up alarms and notifications when your CPU temperature reaches a certain threshold.

Conclusion

In this article, we discussed how to check your CPU temperature on Linux. We looked at two different methods: using the terminal and using a GUI tool. Both methods are easy to use and will provide you with the information you need to keep your system running smoothly.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?