How To View CPU Temperature On Linux
This brief tutorial describes how to view CPU temperature on Linux using lm_sensors. Lm_sensors, short for Linux-monitoring sensors, is a free software package that provides the necessary tools and drivers for monitoring CPU temperatures, voltage, humidity, and fans. It can also detect chassis intrusions. So, you can find out a defective hardware components, and replace it to avoid the system hanging or overheating issues.
View CPU Temperature On Linux Using Lm_sensors
Installation
Lm_sensors comes pre-installed with most modern Linux operating systems. If it is not installed already, you can install it as shown below.
On Arch Linux and its derivatives:
On RHEL, CentOS, Fedora:
Or,
On Debian, Ubuntu, Linux Mint:
On SUSE, openSUSE:
Configuration
Once installed, run the following command to configure lm_sensors:
The sensors-detect is a stand-alone program for detecting installed hardware and recommending specific modules to load. The “safe” answers are the defaults, so just hit to ENTER the accept the default values. It won’t cause any problems. This will create the /etc/conf.d/lm_sensors configuration file which is used by lm_sensors.service to automatically load kernel modules on boot.
The sample output of the above command in my DELL Laptop:
Now, type the following command to view the CPU temperature information of your Linux box:
Sample output:
As you see in the above output, lm_sensors displays my CPU’s current temperature, high and critical temperature in the brackets. If you find out any of your hardware devices reaches high or critical temperature, you probably need to check that hardware device.
To display the temperatures in degrees Fahrenheit instead of Celsius, use -f option.
To monitor the CPU temperature in real time, you can use ‘watch’ command like below.
Sample output:
Press CTRL+C to stop the monitoring at any time.
For more details, refer the man pages.
And, that’s all. If you find this guide useful, please show your support by sharing it on your social and professional networks.
Cheers!