Monitoring sensors and temperatures in Ubuntu 12.04

Checking  the temperature of your hardware (processor, graphics card, hard drive …) is important to know how our computer is doing and if you have problems with high temperatures, either by  degradation of the materials in contact with the micro or simply by a fan that stopped working.


To prevent any of these problems, we will see how to monitor the temperatures of a machine running Ubuntu 12.04.




To detect motherboard and processor Sensors we need to install the “lm-sensors” library  (lm-> is a lowercase) in a terminal with the command:

sudo apt-get install lm-sensors


To detect sensors for the hard drives need to install “hddtemp” by typing the following in command:

sudo apt-get install hddtemp


Note: During the installation of “hddtemp” you will have to select “YES” to all options.

Note: when the installer asks if we want to run the hddtemp daemon at startup (to detect the sensors from the system boot), select “YES”.


Hddtemp listens a port, so you must have root privileges to listen. To view the hard disk temperature when using applications from our users session, we must give appropriate permissions:

sudo chmod u + s /usr/sbin/hddtemp

Warning: Doing it this way can create a security hole, if you don’t have your firewall properly configured. It is recommended NOT to grant these permissions and run the command from the terminal as explained below (for conky, there is a separate trick, also explained below).


Command to reconfigure hddtemp, just in case something went wrong or if it is required to change some settings:

sudo dpkg-reconfigure hddtemp

Note: The first question made by the wizard is to grant permissions. Select NO if you do not want to give them.





Once all the required libraries are installed, Ubuntu will detect the sensors in the computer with this command:

sudo sensors-detect


Begins asking questions and showing the option recommended by Ubuntu (in capitals). Select it by typing the letter and pressing Enter or simply pressing Enter.

Note: Try not to blindly press Enter because in the end is asks “Do you want to add these lines to /etc/modules Automatically? (Yes / no)”. This causes the system to automatically load the sensors libraries on reboot.

Reboot the system and you are ready to go.


Possible Error

There are people that have problems using the default sensor order set by ubuntu, it is then recommended to change that order in the  /etc/modules file, for example:

Among the information that is given to us at the end of the sensors detection (before the last question) look between the lines that say “cut here”, it says something like this:

# —- Cut here —-

# Chip drivers



# —- Cut here —-

So choose No to the previous default configuration option and change the order manually, like this:

# —- Cut here —-

# Chip drivers



# —- Cut here —-




Terminal or Console

We monitor the temperatures of the motherboard and processor from the terminal with the command:


And the hard disk (/dev/sda) with:

sudo hddtemp /dev/sda

Note: If we have more hard drives (/dev/sdb, /dev/sdc, …), change “/dev/sda” with the corresponding command.



Available at the Software Center, allows for graphically monitor the temperature of the hardware.



  • Monitors sensors in the motherboard, processors, dedicated graphics cards (GPU), hard drives, fans and CPU usage.
  • You can set an alarm so that you are alerted with an information balloon when temperature reaches a certain value (at your option).
  • Graphic window of temperatures, fan speed and cpu usage.
  • Configuration of colors and sensors that we want to show.
  • Icon in the top panel with quick access to information




sudo apt-get install psensor


Execution: Press Start (1st launcher bar with Ubuntu logo) and write psensor

  • In the Psensor menu you can find:
  • Application Preferences (background color, time of monitoring and configuration of the interface (window).
  • Preferences for the sensors (information and alarms)
  • Sensors can also be directly monitored from the thermometer -shaped  icon in the top panel, without having to open a new window:



Conky is a lightweight and configurable monitor for the system, that shows a lot of information on the desktop, including temperatures.

To monitor the temperature of the HDD in Conky, I use “netcap” (a powerful application for the terminal). The command to enter would be like:

nc localhost 7634 | cut-c30-31

“Loclhost nc 7634” is to listen on port 7634 with “Netcap” (nc) and then use the pipe “|” to filter the results by adding the command “cut” (c) to delimit the variable characters (30 and 31) of the temperature, that depend on your hard drive.

For example, you can run in your terminal:

nc localhost 7634

It outputs something like this:

|/Dev/sda|TOSHIBA MK5059GSXP|38|C|

What you want is temperature: 38. The position (including spaces) in which both characters are 3 and 8 must be count (in this example “3” is the character number 30 from the line returned by the terminal and “8” is the number 31)


I do the same for the “Core” (processor cores), using the “sensors” command.

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post

Leave a Reply