To get the temperature of a Raspberry Pi, simply run this script in a terminal
/usr/bin/vcgencmd measure_temp
That’s it! Put it in a script, run it alone in the CLI, or create an alias so you’re not having to type it every time.
For instance, a simple alias would be:
alias pitemp = '/usr/bin/vcgencmd measure_temp'