How To Get HDD Temperature in Linux - Linux Tutorials - Learn Linux Configuration
How To Get HDD Temperature in Linux - Linux Tutorials - Learn Linux Configuration
Menu
In this tutorial, you will see how to get the temperature of a hard drive disk on a
Linux system. The installation instructions and command examples below will get
you started.
1 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
The tools we will be using are not usually included by default on most Linux distros.
2 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
You can use the appropriate command below to install inxi and hddtemp with your
systemʼs package manager.
To install inxi and hddtemp on Fedora, CentOS, AlmaLinux, and Red Hat:
$ sudo fdisk -l
OR
$ lsscsi -g
Hard drives will have a path in the format of /dev/sdX for example.
Example 1 Using the inxi tool now we can determine the temperature of all hard
drives with the following command.
3 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
The hard drive temperature of /dev/sda is 35C. Note that the above command
needs to be run with root administrative privileges.
Example 2 Or to check the temperature of a speci�c block device, just specify that
device in your command. For example, this command checks the temperature of
/dev/sdb .
1 #!/bin/bash
2
3 temperature=$(hddtemp /dev/sda | cut -d : -f3 | sed 's/[^0-9]*
4 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
Closing Thoughts
In this tutorial, you saw how to get the temperature of a hard drive disk on a Linux
system. This is facilitated by the inxi and hddtemp commands, which can easily be
installed via package manager on major Linux distros. You also learned how to adapt
these commands into a Bash script to regularly monitor HDD temperature and
report any major temperature spikes.
System Administration
5 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
NEWSLETTER
Subscribe to Linux Career Newsletter to receive latest news, jobs, career advice and featured
con�guration tutorials.
SUBSCRIBE
WRITE FOR US
LinuxCon�g is looking for a technical writer(s) geared towards GNU/Linux and FLOSS
technologies. Your articles will feature various GNU/Linux con�guration tutorials and FLOSS
technologies used in combination with GNU/Linux operating system.
When writing your articles you will be expected to be able to keep up with a technological
advancement regarding the above mentioned technical area of expertise. You will work
independently and be able to produce at minimum 2 technical articles a month.
6 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
APPLY NOW
TAGS
ABOUT US
FEATURED TUTORIALS
How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux
7 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
How to install Tweak Tool on Ubuntu 20.04 LTS Focal Fossa Linux
How to Install Adobe Acrobat Reader on Ubuntu 20.04 Focal Fossa Linux
How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux
Nvidia RTX 3080 Ethereum Hashrate and Mining Overclock settings on HiveOS Linux
LATEST TUTORIALS
Introduction to Vagrant
8 of 9 4/7/23, 12:36 PM
How to get HDD temperature in Linux - Linux Tutorials ... https://linuxconfig.org/obtain-hard-drive-temperature-i...
9 of 9 4/7/23, 12:36 PM