How to check CPU temperature on Ubuntu Linux nixCraft

How do I check CPU temperature in Ubuntu Linux using a command line and GUI tools on my Thinkpad laptop or Desktop computer?

One of the most common complaints is the overheating laptop, especially older models. Laptop components are tightly put together to each other. So there is very little room for air movement in thinner laptops. If your laptop overheats, it can cause some damage to your body as well as the hardware parts. Therefore monitoring hardware temperature is essential. In this tutorial, you will learn how to check CPU temperature in Ubuntu Linux.

Procedure for monitoring CPU and HDD temperatures on Ubuntu

  1. Open the terminal application.
  2. Install the lm-sensors and hddtemp packages in Ubuntu using the sudo apt install hddtemp lm-sensors.
  3. Run hddtemp command to see SSD and hard drive temperature in Ubuntu.
  4. Execute sensors command to find out CPU temperature in Ubuntu Linux.

Check CPU temperature in Ubuntu Linux

The sensors command is used in Linux to show the current readings of all sensor chips including CPU temp. The hddtemp command will show you the temperature for SSD and HDD. You need to install and configure the lm-sensors package as well as hddtemp. You can search it using the following syntax:
apt-cache search lm-sensors
apt-cache search hddtemp

Check CPU and HDD temp packages in Ubuntu Linux
To install these packages on Ubuntu, run the following apt command or apt-get command in a terminal:
sudo apt update
sudo apt upgrade

Install lm-sensors in Ubuntu Linux

Type the following apt command:
sudo apt install lm-sensors
How to install lm-sensors on Ubuntu Linux
Next you need to detect hardware monitoring chips installed in your laptop. Hence, start the detection of your laptop hardware sensors that will provide information about:

  • Sensors embedded in CPUs and other super I/O chips
  • Hardware monitoring chips accessed through I/O ports and SMBus/I2C bus on your system

Type the following command:
sudo sensors-detect
Ubuntu Linux detect hardware monitoring chips

Display CPU temperature in the command line

Execute the following command:
sensors
See CPU temperature in Ubuntu Linux using the command line option
One can use the watch command command to run sensors command repeatedly, displaying its output on screen:
watch sensors

How can I show the CPU temperature in the GNOME panel

Install Freon and Sensors extension for Ubuntu Linux desktop:
Shows CPU temperature, HDD temperature, voltage and fan RPM

How to install hddtemp in Ubuntu Linux

Run the following apt command:
sudo apt install hddtemp
How to install hddtemp on Ubuntu Linux

How to see hard disk temperature in Ubuntu

Simply type:
hddtemp
sudo hddtemp SATA:/dev/sda

Sample outputs:

/dev/sda: Samsung SSD 850 EVO 500G: 32°C

Use disks & storage GUI tool to view hard disk temp

Hard disks have a built-in health-check tool called SMART (Self-Monitoring, Analysis, and Reporting Technology), which continually checks the disk for potential problems. SMART also warns you if the disk is about to fail, helping you avoid loss of important data. It also displays hard disk temperature. Run:
gnome-disks
Monitoring hard disk Temperatures on Ubuntu Linux with GUI tool

How to monitor Nvme ssd temperature in Ubuntu

First install nvme-cli, run:
sudo apt install nvme-cli
Now use the nvme command as follows to get list of all NVMe devices and namespaces on machine:
sudo nvme list
Sample outputs:

Node SN Model Namespace Usage Format FW Rev ---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 S3EUNX0JXXXXXXH Samsung SSD 960 EVO 500GB 1 36.53 GB / 500.11 GB 512 B + 0 B 2B7QCXE7

sudo nvme smart-log /dev/nvme0
One can filter output using the grep command:
sudo nvme smart-log /dev/nvme0 | grep temperature

temperature : 40 C

Releated: Linux Monitor Hard Disks Temperature With hddtemp

What to do when a laptop gets way too hot

  • Open your laptop and remove (blow out) all the dust from fans and hardware.
  • Buy a good laptop cooler to place your laptop on.
  • Make sure your Thinkpad laptop positioned on a flat and hard surface.
  • Shutdown unwanted Linux apps that use lots of CPU, ram, hard drive, and stress out your system.
  • Above all use power saving mode on your laptop.

Conclusion

In conclusion, keep your laptop fan clean and dust free to reduce the temperature. In some extreme cases, you may need to replace a heat sink to keep a hot component such as a processor cool. Similarly, use the quality thermal paste to fill in the gaps and allow for better transfer of heat from the heat spreader to the heatsink. I hope to find out CPU temperature in Ubuntu Linux help you to keep your laptop healthy and use it for a longer time.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Posted by Web Monkey

Leave a Reply