Views:
677β
Votes: 8β
Tags:
ssd
temperature
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1563116
Title:
Smartctl: how to output SSD temp number only?
ID:
/2026/01/22/Smartctl_-how-to-output-SSD-temp-number-only_
Created:
January 22, 2026
Edited: January 22, 2026
Upload:
February 8, 2026
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
On my machine the temperature isnβt the last field, itβs the third last field. However, on both your machine and mine, the temperature is the 10th field:
$ sudo smartctl -a /dev/sda | grep -i temp
194 Temperature_Celsius 0x0002 176 176 000 Old_age Always - 34 (Min/Max 12/51)
Iβve never mastered awk so I use βlow-techβ programs:
$ sudo smartctl -a /dev/sda | grep -i temp | tr -s ' ' | cut -d ' ' -f 10
34
Breakdown:
tr -s ' '- Compress extra white space. E.G.Old_age AlwaysbecomesOld_age Always(Notice 3 spaces are only 1 space now).
cut -d ' ' -f 10- Treat a single space as a field separator and then print the 10th field.
awk is definitely more powerful but the simple commands are easier for me to maintain so Iβve used them for a decade and focused on learning other things like bash and python.
Compressing all the white space into a sing space using tr is very important. This way you can count the temperature which is the 10th field and pass that to the cut command. If you didnβt use tr you would have to pick the 37th field (in my case):
$ sudo smartctl -a /dev/sda | grep -i temp
194 Temperature_Celsius 0x0002 171 171 000 Old_age Always - 35 (Min/Max 12/51)
$ sudo smartctl -a /dev/sda | grep -i temp | cut -d ' ' -f 37
35