Having built and configured your nice new machine, you may want to keep an eye on temperatures and fan speeds. The main package used to do this is lm-sensors, which can be installed using apt-get.
sudo apt-get install lm-sensors
Although there is basic info for older versions of Ubuntu in the Community Documentation, there are very good instructions on this page on compdigitec.com. Once you’ve installed lm-sensors, you can view data at any point by running the command sensors in a terminal window. The compdigitec article was published in 2008 and so still mentions a ‘panel’ as used to be found in GNOME 2. These are defunct in Unity, which comes as the default on Ubuntu 11.04, so if you want a GUI representation of your temperature and/or fan data then Psensor is probably the way to go. You’ll need to add a new software repository as it isn’t included in the standard ones; ubuntuguide.net has a good walkthrough here. Unfortunately all the motherboard / chipset temperatures and fans are just labelled temp1, temp2 and temp3, so although you know which are your CPU temps you might not be able to identify the others.
sensors didn’t pick up hard drive temperatures for me, but you can get those by running:
sudo hddtemp /dev/sda
This assumes you have a SATA drive; for older devices, use /dev/hda/ in place of /dev/sda. For more generic information about your hard drive, you can run the similar hddparm, i.e.:
sudo hddparm /dev/sda
Both were installed on my system by default, but can be obtained using apt-get if required. Thanks to embraceubuntu.com for pointing these out. Finally, I’ve put together a little script to pull the main information from my system into an easy-to-read few lines. Feel free to use and modify for your system as required:
#!/bin/bash # Get output of sensors `sensors > ~/sensors.out` # I'm sure there's a way to do this using arrays and loops instead of repeating code # I just haven't found it yet # Parse output to get core temperatures CORE0=`grep '^Core 0' ~/sensors.out | awk '{print $3}'` CORE0=${CORE0#*+} CORE0="${CORE0%.*}°C" CORE1=`grep '^Core 1' ~/sensors.out | awk '{print $3}'` CORE1=${CORE1#*+} CORE1="${CORE1%.*}°C" # Parse output to get other temperatures TEMP1=`grep '^temp1' ~/sensors.out | awk '{print $2}'` TEMP1=${TEMP1#*+} TEMP1="${TEMP1%.*}°C" TEMP2=`grep '^temp2' ~/sensors.out | awk '{print $2}'` TEMP2=${TEMP2#*+} TEMP2="${TEMP2%.*}°C" TEMP3=`grep '^temp3' ~/sensors.out | awk '{print $2}'` TEMP3=${TEMP3#*+} TEMP3="${TEMP3%.*}°C" #Display core temperatures echo "Core 0: $CORE0" echo "Core 1: $CORE1" # Display other temperatures echo "Temp 1: $TEMP1" echo "Temp 2: $TEMP2" echo "Temp 3: $TEMP3" # Check hddtemp, if using sudo if [ "$(id -un)" = "root" ]; then sudo hddtemp /dev/sda | awk '{print "HDD: ",$4}' fi # Display fan speed FANSPEED=`grep 'fan1' ~/sensors.out | awk '{print $2}'` echo "Fan: $FANSPEED RPM" # Clean up rm ~/sensors.out