Using hddtemp (en)

From Conky PitStop

Jump to: navigation, search

Using hddtemp

 Language   English   Français   

A wonderful way to utilize your hard drive’s built-in SMART Tools and monitor the temperature of your drive is with hddtemp. It’s a small download, a simple setup, and the information it gives you is priceless.


Let’s get going! In a terminal:

sudo aptitude install hddtemp

Once it’s installed, it can be invoked at a terminal by issuing

sudo hddtemp /dev/sdX

where X is, of course, the letter of the drive you wish to check. hddtemp can check multiple devices in one call, but for our uses in Conky, one is enough.

Since you can’t issue sudo commands from inside Conky, before we use it, we’ll need to get rid of the need for root access to issue the command. While your terminal is still open, enter this command

sudo chmod u+s /usr/sbin/hddtemp

now, you should be able to use hddtemp from a terminal without using sudo. On to Conky usage. A typical hddtemp output will look something like this:

$ hddtemp /dev/sda
/dev/sda: Hitachi HTS541612J9SA00: 37°C

That’s kind of messy for display in Conky, so we’ll use the cut command to shorten it up. I’ve seen some people with multiple drives and they like to keep the drive names in the output. I only have one drive, so I don’t need that effect. l You can either count the characters, or do the ol’ trial-and-error thing; whatever works best for you. I like having the little degree symbol in mine, so I make sure to cut that, too. Your tastes may vary. In the end, my command looks like this:

$ hddtemp /dev/sda | cut -c 36-40

And you can see I have a nice, neat temperature readout. Now to get this command into Conky so we can see the information at a glance. This will take an $execi statement, so that the command will be issued periodically. Since you’ll want the info labeled “Drive Temp” or “HDD Temp” or something similar, the .conkyrc line will look something like this:

Drive Temp: ${execi 10 hddtemp /dev/sda |cut -c36-40}

There’s been a method developed by Crinos512 to colorize the temperature, so it will appear different colors for different temperature ranges – but that’s another tutorial.

Personal tools