Monitoring CPU tempreture and Fan speed through Shell Scripting

First we need to install lm-sensors (Linux Monitroing Sensors) tool. The lm-sensors provides tools and drivers for monitoring temperature, voltage, humidity and fans speed. First start terminal and update the repository

sudo apt-get update

now Install lm-sensors

sudo apt-get install lm-sensors

after the completion of installation type following command in terminal

sudo sensors-detect

after that run following command

sudo service kmod start

It will ask you few questions, Answer 'Yes' for all of them. Finally to get your CPU temperature type sensors in your terminal.


Now here is the simple shell script which prints the CPU temperature and Fan Speed.
 # Shows the cpu tempreture and Fan speed  
 while ((1))  
      echo "CPU Tempreture : "  
      echo "==========================================================|"  
      sensors | egrep "Core|fan"  
      echo "==========================================================|"  
      sleep 2  

the output of script   ./

Thanks...!! (*_*)