Linux

How to Check CPU Temperature on Linux?

Introduction

The central processing unit, or CPU, is an important element of running a computer. Just like any other electrical and electronic device, it gets heated. Did you know that an average computer uses approximately 70 Watts of electricity? 

CPU overheating is a major concern that impacts the overall performance of the computer. It can occur for many reasons, including bad airflow and improper cooling systems. Do you know you can check CPU temperature on Linux? We will discuss the core concept of CPU temperature on Linux and its importance. Also, this article will help you get Linux CPU temperature

Why Does CPU Temperature Matter?

Why Does CPU Temperature Matter?

CPU powers a computer to run all the software and programs that the user needs. It can be compared to the main power generator of a big building that is responsible for the power supply. With this generator, people can not work on their systems or enjoy a coffee at their favorite cafe inside that building. A CPU is just like a generator; it is responsible for the proper running of the computer. If this unit heats up, it will lead to a deep slowdown in the computer, eventually leading to a system crash. This means that improper cooling or bad airflow might become a problem in the day-to-day working of a computer. This is why CPU temperature matters a lot in every operating system, including Linux.

Also Read: How to Check CPU Utilization in Linux using Command Line?

Understanding CPU Temperature on Linux

Understanding CPU Temperature on Linux

The temperature of the CPU is measured differently on each operating system. If you have a Linux-based system, then you will be using a command line method to measure the central unit’s temperature. It is important to note that Windows and MacOS don’t rely on a command line tool to perform measurement actions. So, when it comes to Linux CPU temperature reading, you would be dealing with a kernel interface. This also means that the readings will vary based on the kernel version. A Linux-based system can get CPU temperature through programs like lm_sensors, psensor, and s-tui. We will discuss these methods in the next section. 

Check CPU Temperature Using Lm-Sensors

Check CPU Temperature Using Lm-Sensors

The “lm-sensors” is a package that can be used to determine the CPU temperature for Linux. You can follow the steps below to act.

  • The very first step is to install the lm-sensors. Here, we will assume that you have a Ubuntu-based system. The following command will simultaneously install and update lm-sensors on the system:
Check CPU Temperature Using Lm-Sensors
  • The next step is related to the detection of present sensors in the system. The lm-sensor will use these already present sensors to see if they still comply with the system. The following command can be used to detect these sensors: 
Check CPU Temperature Using Lm-Sensors
  • When the lm-sensors finish the detection, the temperature readings can easily displayed through the following commands: 
Check CPU Temperature Using Lm-Sensors

Now, let’s take a look at the application-based approach below. 

Check CPU Temperature Using Psensor

Check CPU Temperature Using Psensor

Psensor is an application that lets the user check CPU temperature on Linux. Take a look at how all these steps are performed.

How to install Psensor?

  • The very first step is to update the package of the current system. You can do so with the command “sudo apt update.”
  • Now run the “sudo apt-get install psensor” in the command-line. You can use the command “yay -S psensor” if using the Arch-Linux system.
  • At this point, the Psensor application is installed on the system. You can now go to the applications menu, search for “Psensor,” and simply open it. 

How to Use a Psensor?

Once the Psensor application has been launched, follow these steps to start using the application. 

  • The application will display every detail regarding the CPU temperature on Linux
  • Every detail regarding the CPU temperature will be on your screen when you launch the application. 
  • If you want to check separate CPU cores, then go to the “core 0.”
  • You can modify the temperature readings data display by right-clicking on it. You will get the option for Celsius or Fahrenheit once you click on the reading. 
  • In this application, you can even try to set alerts as per your specifications through the “preferences” option. 

Check Temperature Without Third-Party Utilities

Check Temperature Without Third-Party Utilities

Linux relies heavily on the command line. If you want a third-party utility, then you will have to install it through the command line. Third-party software can come with additional features. Let’s see how one can use these external utilities to display CPU temperature on Linux

  1. Linux displays temperature information through the “/sys” filesystem. Use the following command to reach the filesystem:
Check Temperature Without Third-Party Utilities
  1. The next step is to list the readings by entering the “ls” command in the terminal.

Conclusion 

The health of the CPU matters a lot for the proper running of the computer. High temperature is an important factor affecting the health of the CPU. A perfect balance of energy and efficiency is needed to perform different tasks on a computer. This is why it is important to check this temperature reading always. Through this article, we have addressed the issue of overheating of the CPU and how it can be measured. 

Different operating systems have different ways to assess this reading. A Linux-based system can offer CPU temperature reading through the command-line tool. Built-in tools like lm-sensors offer a command-line approach to checking CPU temperature, while applications like Psensor provide a more user-friendly graphical interface. Each method has its own advantages and can be chosen based on personal preference and requirements. A regular checkup of CPU temperature on Linux can identify potential issues related to cooling, airflow, or system workload in advance.

Arpit Saini

He is the Chief Technology Officer at Hostbillo Hosting Solution and also follows a passion to break complex tech topics into practical and easy-to-understand articles. He loves to write about Web Hosting, Software, Virtualization, Cloud Computing, and much more.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *