How to get CPU temperature on Ubuntu Linux

Overheating of hardware usually causes system performance to degrade. Monitoring the hardware temperature can help you diagnose any CPU overheating problems in the system. The cause of laptop overheating usually comes from the high temperature of CPU, GPU (video card) or hard disk.

If your laptop gets hot, make sure it is in the correct position to avoid restricting airflow. You must have a clean, clean laptop cooler, not covered with dust, and remove all unnecessary software that takes up too much CPU. Operating the laptop in power saving mode also reduces overheating.

In this tutorial, we will learn how to get the CPU temperature on Ubuntu Linux from the command line and from the desktop.

1) Use Lm_Sensors to check the CPU temperature

Lm_sensors is a command line tool used to display the current readings of all chip sensor data, including CPU temperature. By default, most Linux distributions do not have Lm_sensors installed, so we must install them ourselves.

Therefore, let us first check how to install the lm-sensors package on various Linux distributions.

On Ubuntu / Debian

Press the shortcut key to open the terminal on Ubuntu CTRL + ALT + T Test and install Lm_Sensors on my Ubuntu 18.04, Ubuntu 20.04 and Debian 10 by running the following command from the keyboard:

$ sudo apt install lm-sensors

If you want to print the temperature and fan speed of the remote server, please install Psensor Server.

$ sudo apt-get install psensor-server

On Arch Linux

To install lm_sensors on Arch Linux, please enable additional repositories in ‘/etc/pacman.conf’. Then run the following pacman command from the terminal:

$ sudo pacman -S lm_sensors

On Fedora

Use the dnf command to install lm_sensors on Fedora Linux.

$ sudo dnf install lm_sensors

On CentOS / RHEL

Install lm_sensors on CentOS 7 and RHEL 7 using yum command

$ sudo yum install lm_sensors

Detect compatible sensors on Ubuntu Linux

Next, we need to detect the hardware monitoring chip installed in the laptop. So now we can start to detect the hardware sensors of the laptop. This will provide information about the following:

  • Sensors embedded in CPU and other super I / O chips
  • Hardware monitoring chip accessed through I / O port and SMBus / I2C bus on our system

We do this by entering the command sudo sensor-detect:

$ sudo sensors-detect 
# sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)
# System: LENOVO 20FMS1W300 [ThinkPad T460] (laptop)
# Kernel: 4.15.0-96-generic x86_64
# Processor: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (6/78/3)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): yes
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 16h thermal sensors...                           No
AMD Family 17h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
Intel 5500/5520/X58 thermal sensor...                       No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): yes


Display CPU temperature on the command line

We have successfully installed the lm-sensors software package and have successfully detected supported sensors on laptops powered by Ubuntu Linux.

Now we can execute the following command to view the temperature data:


Please note that the results will vary depending on your computer.

$ sensors
Adapter: Virtual device
temp1:        +33.0°C  

Adapter: Virtual device
temp1:        +38.5°C  

Adapter: ACPI interface
in0:         +12.45 V  

Adapter: ISA adapter
Package id 0:  +39.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +39.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +38.0°C  (high = +100.0°C, crit = +100.0°C)

Adapter: ISA adapter
fan1:           0 RPM
temp1:        +38.0°C  
temp2:            N/A  
temp3:         +0.0°C  
temp4:         +0.0°C  
temp5:         +0.0°C  
temp6:         +0.0°C  
temp7:         +0.0°C  
temp8:         +0.0°C  

Adapter: ACPI interface
in0:         +12.49 V  

Adapter: ACPI interface
temp1:        +38.0°C  (crit = +128.0°C)

You can also use the watch command to continuously run the sensor command, which will display the sensor output changes on the screen:

$ watch sensors

2) Use the Psensor GUI tool to check the CPU temperature

We will use the GUI tool Psensor, which allows you to monitor the hardware temperature on Linux.

With Psensor, you can check the following:

  • Temperature of motherboard and CPU sensor and NVidia GPU
  • Hard drive temperature
  • speed of the fan
  • Monitor CPU usage

The latest version of Psensor also provides an applet indicator for Ubuntu, so it makes it easier to monitor hardware temperature on Ubuntu. You can choose to display the temperature in the top panel itself. When the temperature exceeds the limit, it can even send desktop notifications.

We can continue to install Psensor using the following command:

Ubuntu / Debian

$ sudo apt install psensor


$ sudo dnf install

CentOS and RHEL

$ sudo yum install

After installation, run the application by looking in the Unity Dashboard. At the first run, you can configure the statistics (sensors) to be collected using Psensor.


Psensor temperature monitor

psensor graph

Psensor CPU temperature curve

If you want to display CPU statistics (including temperature) in the top panel, go to “Sensor Preferences.” Then under the “Application Indicators” menu, select the component for which you want to display temperature. Then check the “Display Sensor” in the tab options.

psensor preferences

3) Use “Hardinfo” to check the CPU temperature

Hardinfo is a system analyzer and benchmarking tool for displaying hardware information in the GUI in Linux. You can also check the CPU temperature from the GUI-device-sensor.

On Ubuntu and Debian

$ sudo apt install hardinfo

On Arch Linux, you can find hardinfo in the community repo

$ sudo pacman -S hardinfo

Run the following command on the terminal to display hardware information on the GUI.

# hardinfo

hardinfo-CPU sensor

HardInfo-CPU sensor

Hardinfo processor

Hardinfo processor

Use ‘i7z’ to find the CPU temperature

i7z is a command line tool that can print CPU information on Intel Core i7, i5, i3 processors and report CPU temperature. i7z needs to run as root or a user with sudo privileges.

To install on ubuntu, run the following command:

$ sudo apt install i7z

i7z Linux

i7z command output

in conclusion

In addition, you can try TLP and Thermald, which can help you control the CPU temperature on Linux. Cpufreq is another tool that can help you save battery power and reduce laptop overheating, which works well on Ubuntu.

Before I used “Conky” for several years, “Conky” is a lightweight desktop monitor that can display CPU, memory, swap space, disk storage, temperature, progress, network interface, battery power and other statistical information.

If you want to check the temperature without third-party tools, please check the / sys / devices / virtual / thermal / thermal_thermal1 / zone1 / temp file.

To check the temperature of the hard disk, you can install the hddtemp software package.

Finally, if you have any questions or feedback, please feel free to leave a comment.