How to get the highest temperature from all sensors in a server on Linux?

Posted on In QA

It is useful to monitor a server node’s temporary. Among all the sensors’ temperatures, the higher one may be a very important one. How to get the highest temperature from all sensors in a server on Linux?

You can use this command to get the the highest temperature from all sensors in a server on Linux:

sensors | grep '°C' 
| cut -d '°' -f1 | rev | cut -d' ' -f1 | rev | tr -d '+' 
| sort -n | tail -n1

The first line gets all the lines with a degree. The second line get out only the temperature’s number. The third line sorted the numbers and get the highest one.

One example:

$ sensors | grep '°C' | cut -d '°' -f1 | rev | cut -d' ' -f1 | rev | tr -d '+' | sort -n | tail -n1
74.0

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 *