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?

asked Apr 8, 2016 by anonymous

1 Answer

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-
answered Apr 21, 2016 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

...