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

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?

asked Jul 31, 2017 by Eric Z Ma (44,280 points)

1 Answer

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
answered Jul 31, 2017 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...