Get CPU Temperature On Linux - Linux Tutorials - Learn Linux Configuration
Get CPU Temperature On Linux - Linux Tutorials - Learn Linux Configuration
org/get-cpu-temperature-on-linux
Menu
The ability to get the temperature of a key component such as a CPU is important, whether you are gaming, overclocking, or hosting intensive
processes on a critical server for your company. The Linux kernel comes with modules built in that allow it to access onboard sensors within the
CPU. In this tutorial, you will learn how to access these sensors and get the CPU temperature on a Linux system.
There is a program that will work in conjunction with the kernel modules mentioned above to display the readings of the CPU temperature in the
userspace. The program is called lm_sensors. This so�ware allows users to get a readout of the CPU temperature in the command line and
interfaces with several graphical front ends that make displaying temperatures in real time automatic and easy.
1 of 6 4/7/23, 12:33 PM
Get CPU temperature on Linux - Linux Tutorials - Learn... https://linuxconfig.org/get-cpu-temperature-on-linux
Other Privileged access to your Linux system as root or via the sudo command.
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
Conventions
$ – requires given linux commands to be executed as a regular non-privileged user
The lm_sensors so�ware allows users to retrieve the temperature of their CPU on Linux. This package is available on all major Linux distros and
can be installed from the default system repositories.
You can use the appropriate command below to install lm_sensors with your systemʼs package manager.
$ sudo sensors-detect
The program will pose a number of questions about which sensors to use. It will suggest a best option for each one. If you donʼt know which sensors
to pick, go with the recommendations until the end where it asks if you want to save the con�guration. Always save it. Of course, you can use your
best judgment regarding which sensors to use.
Now you may use the sensors command to see a list of your systemʼs current temperatures.
$ sensors
2 of 6 4/7/23, 12:33 PM
Get CPU temperature on Linux - Linux Tutorials - Learn... https://linuxconfig.org/get-cpu-temperature-on-linux
k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp: +32.0°C
Core0 Temp: +33.0°C
Core1 Temp: +29.0°C
Core1 Temp: +25.0°C
nouveau-pci-0200
Adapter: PCI adapter
temp1: +58.0°C (high = +100.0°C, crit = +120.0°C)
To continuously monitor the CPU temperature, you can start lm-sensors as a service.
Letʼs start by installing Conky. You can use the appropriate command below to install Conky with your systemʼs package manager.
Copy the default Conky con�guration to your home directory. It is better to edit this �le with your custom settings, and to keep the original as a
backup.
$ cp /etc/conky/conky.conf ~/.conkyrc
3 of 6 4/7/23, 12:33 PM
Get CPU temperature on Linux - Linux Tutorials - Learn... https://linuxconfig.org/get-cpu-temperature-on-linux
Open the con�guration �le to make your changes. Since Conky can take input in the form of variables from the execution of command line
programs, thatʼs how you pass sensor information to it.
Running execi sensors in the Conky con�guration will give the output of the sensors. However, that give the whole output, so you may want to
use other command line tools like grep and cut to get the exact output that you want.
Example:
Closing Thoughts
In this tutorial, we saw how to get the CPU temperature on a Linux system. This can be achieved on most Linux distros with the lm-sensors
so�ware. Then, Conky and a number of other GUI utilities can take advantage of lm-sensors in order to display the CPU temperature information.
This provides you with an easy way to get and monitor the temperatures in your system, to ensure that your PC is running as cool as possible.
System Administration
administration, applications, commands, Hardware
Linux basic health check commands
Ubuntu 22.04 vs 20.04 – Whatʼs new?
1 reply
Continue Discussion
NEWSLETTER
4 of 6 4/7/23, 12:33 PM
Get CPU temperature on Linux - Linux Tutorials - Learn... https://linuxconfig.org/get-cpu-temperature-on-linux
Subscribe to Linux Career Newsletter to receive latest news, jobs, career advice and featured con�guration tutorials.
SUBSCRIBE
WRITE FOR US
LinuxCon�g is looking for a technical writer(s) geared towards GNU/Linux and FLOSS technologies. Your articles will feature various GNU/Linux con�guration
tutorials and FLOSS technologies used in combination with GNU/Linux operating system.
When writing your articles you will be expected to be able to keep up with a technological advancement regarding the above mentioned technical area of
expertise. You will work independently and be able to produce at minimum 2 technical articles a month.
APPLY NOW
TAGS
18.04 administration apache applications backup bash beginner browser centos centos8 commands database debian desktop
development docker error fedora �lesystem �rewall gaming gnome Hardware installation java kali manjaro multimedia networking nvidia programming
python redhat rhel8 scripting security server ssh storage terminal ubuntu ubuntu 20.04 virtualization webapp webserver
ABOUT US
FEATURED TUTORIALS
How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux
How to install Tweak Tool on Ubuntu 20.04 LTS Focal Fossa Linux
How to Install Adobe Acrobat Reader on Ubuntu 20.04 Focal Fossa Linux
How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux
Nvidia RTX 3080 Ethereum Hashrate and Mining Overclock settings on HiveOS Linux
LATEST TUTORIALS
5 of 6 4/7/23, 12:33 PM
Get CPU temperature on Linux - Linux Tutorials - Learn... https://linuxconfig.org/get-cpu-temperature-on-linux
Introduction to Vagrant
6 of 6 4/7/23, 12:33 PM