How to get the highest temperature from all sensors in a server on Linux?
Posted on In QAIt 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