How to Check CPU and HDD Temperature in Linux (Ubuntu & Other Distros)

The temperature of the CPU and HDD are checked to ensure the health of the system. When the data of the computer is being processed using the CPU and HDD, it dissipates the heat energy which can cause the hardware damage. 

Similarly, if the CPU and HDD temperature increases to the normal range, it can cause damage to the system components which eventually decreases the system’s life. It also saves the thermal shutdowns on the computer. 

This post walks through the different methods by which users can check the CPU and HDD temperature in Linux. 

How to Check the CPU Temperature in Ubuntu and Other Linux Distros?

To check the CPU temperature in Ubuntu and other Linux distributions, use any of the below-mentioned methods:

  1. Using the sensors package
  2. Using the psensor package
  3. Using the cat command
  4. Using the Glances
  5. Using the Hardinfo

Method 1:  Check CPU Temperature Using the sensors Package

The sensors is the command-line utility that is used to display the temperature and other information of different computer sensors. Follow the next-mentioned steps to use the “sensors” command to check the CPU temperature. 

Step 1: Install lm-sensors

First, install the package of the “lm-sensors” on the Linux distribution:

$ sudo apt install lm-sensors -y

In other Linux distros, it can be installed with the following commands:

Fedora$ sudo dnf install lm-sensors hddtemp
Arch Linux$ sudo pacman -S lm-sensors hddtemp
CentOS$ sudo yum install lm-sensors hddtemp

Step 2: Configure the Computer Sensors

After installing the lm-sensors, configure the detected sensors of the computer:

$ sudo sensors-detect

Step 3: Check CPU Temperature

To display the CPU Temperature, run the command:

$ sudo sensors

Method 2:  Check CPU Temperature Using the psensor Package

Another method of checking the CPU is by using the third-party command-line utility, psensor. To install the “psensor”, execute the command:

$ sudo apt install psensor -y

After installing it, search for the “psensor” in the applications, and then click on it to launch:

The temperature of the CPU has been displayed. 

In Linux distributions, other than Ubuntu, use the below-mentioned command:

Fedora$ sudo dnf install psensor
Arch, Manjaro$ pacman -S psensor
Debian$ sudo apt install psensor

Method 3: Check CPU Temperature Using the cat Command

The cat command can also be used to display the CPU temperature by showing the contents of the /sys/class/thermal/thermal_zone*/temp directory as shown:

$ cat  /sys/class/thermal/thermal_zone*/temp

The temperature has been shown in the output.

Method 4: Check CPU Temperature Using the Glances

Glances can also be used to monitor the temperature of the CPU. It can be installed by using the command:

$  wget -O- | /bin/bash

After downloading and installing the Glances, press the “f” key of the keyboard after launching the glances:

$ glances

Method 5: Check the CPU Temperature Using the Hardinfo

Install the software package of the “Hardinfo” with the below-mentioned command:

$ sudo apt install hardinfo -y

To display the CPU temperature, run the installed package of the hardinfo:

$ hardinfo -rma

How to Check the HDD Temperature in Ubuntu and Other Linux Distros?

To check the HDD temperature in Linux distros, install the “smartmontools” package:

$ sudo apt install smartmontools -y

After installation is completed, display the specific HDD temperature:

$ sudo smartctl -A /dev/sda6 | grep Temperature

These are the methods by which the CPU and HDD temperatures can be monitored.

To learn how to get in-depth CPU information in Linux, go through this mentioned guide.


To check the CPU temperatures, install and use the software packages of “psensor”, “lm-sensors”, “hardinfo”, “glances”, and “smartmontools” in Linux distros. This post has demonstrated all the mentioned methods with examples to monitor the CPU and HDD temperature.