Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ok, so when I run the command:

sensors

I get a truck load of info:

atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:     +1.16 V  (min =  +0.85 V, max =  +1.60 V)
 +3.3 Voltage:     +3.39 V  (min =  +2.97 V, max =  +3.63 V)
 +5 Voltage:       +5.17 V  (min =  +4.50 V, max =  +5.50 V)
 +12 Voltage:     +12.36 V  (min = +10.20 V, max = +13.80 V)
CPU FAN Speed:    1906 RPM  (min =  600 RPM)
CHASSIS FAN Speed:   0 RPM  (min =  600 RPM)
CPU Temperature:   +31.0°C  (high = +60.0°C, crit = +95.0°C)  
MB Temperature:    +32.0°C  (high = +45.0°C, crit = +95.0°C)

What would the command be if I just wanted to see this:

CPU Temperature:   +31.0°C  (high = +60.0°C, crit = +95.0°C)

or better yet, just this:

CPU Temperature:   +31.0°C 
share|improve this question

2 Answers 2

up vote 6 down vote accepted

You can process the output of sensors command with grep and/or cut to format it the way you want.

To get only the line reporting the CPU temperature you can use this (including the high and critical limits):

sensors | grep -A 0 'CPU T' 

The following will give you only the temperature (with the °C suffix) :

sensors | grep -A 0 'CPU T' | cut -c18-25

This will give the output as you indicated at the end of your question:

sensors | grep -A 0 'CPU T' | cut -c1-25
share|improve this answer
    
Thanks a million, this has helped me so much, though one thing, the output in Terminal is perfect it reads as: >CPU Temperature: +33.0°C But when I try to output to firefox I get: >CPU Temperature: +33.0°C Which looks untidy, any suggestions? –  Switchkick Oct 15 '10 at 11:37
1  
I have seen the same as well (especially while working with Conky). I don't know why this happens, though I am able work around it. In case of conky, I cut off the output only until the value (without the °C suffix) and then add this as static text. Can you detail what is the problem you are trying to solve that requires you to pipe this output to firefox ? –  koushik Oct 15 '10 at 12:39
    
I'm working towards my server being able to send me a tweet on twitter when it reaches a certain temperature. Thank you for giving me a hand! –  Switchkick Oct 15 '10 at 13:15
1  
Ah! now I understand. Would it still help, if you use sensors | grep -A 0 'CPU T' | cut -c18-22 (which is chop off the *c suffix) and format this into a tweet ? Like so: ` echo "$(sensors | grep -A 0 'CPU T' | cut -c1-22)" degree C` Play with the cut interval (c1-22) till you are satisfied. –  koushik Oct 15 '10 at 13:43

Install the small apci package with the following command:

sudo apt-get install acpi

You will need to press Y for confirmation for the first time.

Now to find the CPU temperature with this command:

acpi -t
share|improve this answer

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.