How do I get the CPU temperature?

share|improve this question
2  
Related: hardware sensors, indicator and fan control. – Lucio May 25 '15 at 18:15

12 Answers 12

up vote 378 down vote accepted

Install lm-sensors Install lm-sensors

sudo apt-get install lm-sensors 

After installation type the following in terminal

sudo sensors-detect

You may also need to run

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.

sensors

Output:

karthick@Ubuntu-desktop:~$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +41.0°C  (high = +78.0°C, crit = +100.0°C)  

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +41.0°C  (high = +78.0°C, crit = +100.0°C)  

w83627dhg-isa-0290
Adapter: ISA adapter
Vcore:       +1.10 V  (min =  +0.00 V, max =  +1.74 V)   
in1:         +1.60 V  (min =  +1.68 V, max =  +1.44 V)   ALARM
AVCC:        +3.30 V  (min =  +2.98 V, max =  +3.63 V)   
VCC:         +3.28 V  (min =  +2.98 V, max =  +3.63 V)   
in4:         +1.85 V  (min =  +1.66 V, max =  +1.11 V)   ALARM
in5:         +1.26 V  (min =  +1.72 V, max =  +0.43 V)   ALARM
in6:         +0.09 V  (min =  +1.75 V, max =  +0.62 V)   ALARM
3VSB:        +3.30 V  (min =  +2.98 V, max =  +3.63 V)   
Vbat:        +3.18 V  (min =  +2.70 V, max =  +3.30 V)   
fan1:          0 RPM  (min = 10546 RPM, div = 128)  ALARM
fan2:        892 RPM  (min = 2136 RPM, div = 8)  ALARM
fan3:          0 RPM  (min = 10546 RPM, div = 128)  ALARM
fan4:          0 RPM  (min = 10546 RPM, div = 128)  ALARM
fan5:          0 RPM  (min = 10546 RPM, div = 128)  ALARM
temp1:       +36.0°C  (high = +63.0°C, hyst = +55.0°C)  sensor = diode
temp2:       +39.5°C  (high = +80.0°C, hyst = +75.0°C)  sensor = diode
temp3:      +119.0°C  (high = +80.0°C, hyst = +75.0°C)  ALARM  sensor = thermistor
cpu0_vid:   +2.050 V

To see HDD temperature Install hddtemp Install hddtemp

sudo apt-get install hddtemp

Output:

karthick@Ubuntu-desktop:~$ sudo hddtemp /dev/sda        
/dev/sda: ST3160813AS: 34°C
share|improve this answer
4  
This doesn't work on all hardware. On my system, sensors always shows a temperature of +40.0°C. – Keith Thompson Sep 6 '12 at 18:53
5  
On my 13.04 system, it's sudo service kmod start instead of sudo service module-init-tools start – knb Jul 10 '13 at 6:51
50  
You can run watch sensors to see temperature values updating each second. – Drew Noakes Aug 3 '13 at 21:09
10  
It gives warnings about being risky. Are you sure you should answer "yes" to everything? I don't think they have put those messages there for fun... – Jop V. Sep 28 '13 at 10:50
2  
What are the three temperatures temp1, temp2, temp3? @karthick87 ? – spharish Jun 27 '15 at 6:18

Quick command-line solution

cat /sys/class/thermal/thermal_zone0/temp

Applet

If you are looking for a easier-to-access version, add a Hardware Sensors Monitor to Gnome-Panel:

  1. sudo apt-get install sensors-applet - this will install the sensors-applet Install sensors-applet package
  2. Right-click the panel, select Add to panel..., then select this: alt text

  3. You're done. You can configure which sensors are displayed by right-clicking the applet and selecting Preferences->Sensors.

    alt text

share|improve this answer
9  
Your command-line solution may not work for all.Because the path will be different for every kernel version. – karthick87 Dec 2 '10 at 10:02
2  
Yeah it didn't work for me. – 8128 Jun 1 '12 at 14:17
2  
My Ubuntu 12.04 system has no /proc/acpi/thermal_zone/THRM/temperature; in fact there's nothing under /proc named temperature. – Keith Thompson Sep 6 '12 at 18:56
11  
Thats because '/proc' is deprecated; try '/sys/class/thermal/thermal_zone0/temp' – mathepic Jul 15 '13 at 19:03
2  
+1 for quick command line option. Answer would benefit from adding more info about it (@mathepic comment and info about other paths possible). – LIttle Ancient Forest Kami Jul 15 '13 at 20:00

A good indicator for monitoring temperature, fan speeds and voltage is psensor. It shows output of all sensors, draws graphs. Also selected outputs can be placed in indicator panel.

psensor in action

It can be installed from Ubuntu repositories by clicking psensor Install psensor or typing:

sudo apt-get install psensor

Newer versions of psensor can be installed from ppa:

sudo add-apt-repository ppa:jfi/ppa
sudo apt-get update
sudo apt-get install psensor

It can also draw graphs when you tick the boxes in the graph column:

Screenshot

Here is some information with more pictures.

Another useful link

In some cases not all sensors are displayed. Then you can run

sudo sensors-detect

and answer "yes" to all questions. But is not quite safe in some cases, but I never had any real problems with that. A safer way is to take default answers.

Some additional sensors may appear.

share|improve this answer
    
Now THIS is the bomb. Right on. – SDsolar Jul 11 '17 at 5:13
    
On my Ubuntu 16.04, psensor will sometimes use 30% cpu, driving the temperature up. – dirkjot Nov 24 '17 at 19:17
    
its a shit app. takes up 100% cpu – raaj Dec 15 '17 at 12:06

hardinfo Install hardinfo is very useful tools to get all hardware information.

Install hard info by sudo apt-get install hardinfo. Then you can get temperature by sensors.

sensor

share|improve this answer
19  
Good looking tool, except every single page populates except Sensors (e.g. is blank)... – frumbert Mar 29 '15 at 13:07
14  
not working for Sensors – Mudit Kapil Apr 14 '15 at 17:00
    
@frumbert I think it depends on lm-sensors! – Pandya Aug 21 '16 at 11:49
    
I also like the ARP table. Pretty handy to verify what is connected to my subnet. – SDsolar Jul 11 '17 at 8:51
  1. install the small package of acpi Install acpi by this command

    sudo apt-get install acpi
    
  2. You will need to press Y for confirmation for the first time. Now to find temperature type this command

    acpi -t
    
share|improve this answer
22  
This is simpler than the answers about lm-sensors. Could you explain the difference between acpi and lm-sensors? – BornToCode Jan 23 '14 at 23:24

XSensors

XSensors reads data from the libsensors library regarding hardware health such as temperature, voltage and fan speed and displays the information in a digital read-out.

Open the terminal and type:

sudo apt-get install xsensors lm-sensors

Then detect your computer's hardware sensors by opening the terminal and running the command:

sudo sensors-detect

Then you will get asked a lot of questions about what hardware you want the program to detect. It is generally safe and recommended to accept the default answers to all questions, unless you know what you're doing.

XSensors Screenshot

Xsensors vs. Psensor

XSensors and Psensor both monitor the computer's temperature and the fan speeds. The difference between the two applications is in the level of detail of the information that is displayed and how the information is displayed.

XSensors displays a little bit more specific information than Psensor. Psensor is smaller and more unobtrusive than XSensors and it displays itself on the desktop as a little thermometer icon in the notification area in the upper right corner of the desktop next to the clock. You can right-click the thermometer icon at any time to display the hardware temperatures.

Setting up Psensor to detect your computer's hardware is done the same way as Xsensors, by installing lm-sensors to detect your computer's hardware sensors. Then detect your computer's hardware sensors running the command:

sudo sensors-detect  

and as with Xsensors, accept the default answers to all questions.

In Ubuntu 16.04 Psensor detects your computer's hardware sensors automatically without running sudo sensors-detect

share|improve this answer
1  
Psensor seems to be more advanced – Serge Jan 13 '17 at 17:03
1  
I agree, @Serge. psensor is the one I am going to use. – SDsolar Jul 11 '17 at 8:48
    
I also use Psensor. – karel Jul 11 '17 at 8:50

After you install lm-sensors:

sudo apt-get install lm-sensors

run:

sudo sensors-detect

you can run the following command to view hardware temps:

watch -n 1 sensors

Also, the fan is usually controled by BIOS.

share|improve this answer
7  
i like the tip about using watch, it's one of my favorites. i also recommend adding the -d option to watch to highlight the differences. – Joshua K Dec 25 '15 at 20:05

Temperature without third-party apps

All the answers involve use of third-party utilities. If you want to find out the temperature without installing anything, use:

$ cat /sys/class/thermal/thermal_zone*/temp
69000
69000
67000

Temperature with Conky

If you don't mind third-party utilities I like to use Conky--a light weight system monitor.

Within conky the appropriate system variable to monitor is:

${hwmon 2 temp 1}°C

The display looks like this:

Conky network real-time 4

share|improve this answer
2  
what unit is this? apples? 1/1000th of °C? 59/29402th of °F? – Blauhirn Sep 3 '17 at 22:53
    
@Blauhirn Linux is reporting temperature as "69000" which is 69.000 degrees Celsius. In all my testing it's always be "000" after the implied decimal point so I'm not sure why Linux formats it that way shrugs. Thanks for your comment though it allowed me update conky display with current version. – WinEunuuchs2Unix Sep 4 '17 at 0:14

Just so you guys know, none of this install junk like sensors are needed. Just do an acpi -V and BOOM, you got everything. Example:

Battery 0: Charging, 91%, 00:17:25 until charged
Battery 0: design capacity 3310 mAh, last full capacity 3309 mAh = 99%
Adapter 0: on-line
Thermal 0: ok, 40.0 degrees C
Thermal 0: trip point 0 switches to mode critical at temperature 127.0 degrees C
Thermal 0: trip point 1 switches to mode hot at temperature 127.0 degrees C
Cooling 0: pkg-temp-0 no state information available
Cooling 1: LCD 0 of 100
Cooling 2: Processor 0 of 10
Cooling 3: Processor 0 of 10
Cooling 4: Processor 0 of 10
Cooling 5: Processor 0 of 10

WAY easier than installing all of this and kmod... Just do acpi -V.

share|improve this answer
21  
Right… because you don’t have to install that one? Wrong! The program 'acpi' is currently not installed. You can install it by typing: sudo apt-get install acpi – e-sushi Oct 1 '14 at 20:32
6  
And, it also doesn't always give the same information. On my machine, sensors provides the temperature whereas acpi -V doesn't show anything about it, unfortunately. – Per Lundberg Oct 16 '15 at 21:36
/sys/class/thermal/thermal_zone0/temp

this file holds cpu temperature. So, you can make a script named temp and move it to /bin then in terminal enter temp.

My temp file looks like -

 #!/bin/bash
 cpu_temp=$(< /sys/class/thermal/thermal_zone0/temp)
 cpu_temp=$(($cpu_temp/1000))
 echo $cpu_temp°C

my answer is modified of www.cyberciti.biz

share|improve this answer
    
I've tried 4 machines in different locations and they all give the same reading = 27800. Do you know why this could be? They can't all have the same cpu temp. – Katu Mar 10 '17 at 14:08
    
@Katu I think that might mean 27.8 degrees. I used another program and found my Core 0 was 49 C. Then I did the above command and got 49000. – Philip Kirkbride Apr 20 '17 at 18:06

On Raspberry Pi, you can retrieve the temperatureusing vcgencmd:

vcgencmd measure_temp

Output:

temp=39.0'C
share|improve this answer
2  
No, that will give you the frequency. Use vcgencmd measure_temp – MrD Dec 19 '16 at 13:44

computertemp Install computertemp is a simple applet that shows your current CPU temperature + it has some additional features like alarms. Unfortunately it's not possible (or at least I don't know how) to change its background color, so it doesn't look very nice with the standard Ubuntu theme.

It can be installed the same way as the sensors-applet described in evgeny's answer.


Alt text

computertemp is not available in the newer Ubuntu repositories.

share|improve this answer
2  
in Ubuntu 15.04 sudo apt-get install computertemp results in the error "Unable to locate package computertemp" ... – Nicolas Ivanov Jun 22 '15 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.