How to get the CPU temperatur in command linux on Linux?

Most modern servers or computers have sensors to detect the temperature of various components. On Linux, how to get the CPU core temperatur in command linux?

First, make sure the package “lm-sensors” is installed on your Linux and the command sensors works for you.

Then, you can use this piece of script to get the CPU temperature:

sensors 
| grep 'Core 0' 
| awk '{print $3}' 
| rev | cut -b4- | rev | cut -b2-

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *