Note: this is using the on-board sensor.
The command to do this is:
You can also simplify the command by making an alias and adding it to your ~/.bashrc or as instructed in the bashrc file. Make a file in your home directory called .bash_aliases and put your aliases in that file rather then in the .bashrc file.
Making the .bash_aliases file by running the command:
sudo nano .bash_aliases
Make sure you are in your home directory before making the file. You can check by making sure your terminal says pi@raspberrypi ~ $ and (~) meaning you are in your home directory. if you are not just run the command
In the file wright the aliases. example:
alias temp='/opt/vc/bin/vcgencmd measure_temp'
note: if you don't put the apostrophe ( ' ) before and after the command it wont work. Also note that I put the nickname that you are going to give this command, followed up a equals sign (=).
I hope you guys find this useful is I did. Since i live in a very hot environment that I like to check the temp here and there.