There’s a gem called iStats. It shows you fan speeds, cpu temp, battery cycle stats, and battery temp. Reason this came up for me is that I was asked a question on what the highs and lows were for computers to stay healthy in a remote sensor capacity. I typically try to keep computers above 25 (around -5 Celcius) and while the computer will shit itself off at 212 Fahrenheit (actually between 85 and 100 Celcius), it’s a good idea to keep it below 95 degrees (see https://support.apple.com/en-us/HT201640 for more information on preferred operating temperatures).
So you can use iStats to pull a few temperatures and then automatically send yourself an alert when the computer is getting to an inappropriate temperature (or automatically turn the heat or air on in a space that the computer is in. Anyway, to install iStats:
sudo gem install istats
And to then invoke iStats simply run the istats command: