Linux find NVMe SSD temperature using command line

last updated in Categories , , , , , ,

How do I find NVMe SSD temperature using Linux command line options?

NVMe is an acronym for Non-Volatile Memory Express. It is a communications interface standard that defines a command set and feature set for PCIe-based SSDs. NVMe SSD reads and writes data three to four times faster than the SATA SSDs. You must have support for NVMe with M.2 slot on your motherboard to use NVMe SSD. Most modern Laptops or desktop systems have at least one such slot. This page shows how to read and find out NVMe SSD temperature on Linux.

Linux find NVMe SSD temperature command

The procedure to show NVMe SSD temperature on Linux is as follows:

  1. Open the terminal application
  2. Install nvme-cli tool on Linux using your package manager
  3. Run sudo nvme smart-log /dev/nvme0 Linux command to display temperature information for NVMe SSD

Let us see how to install nvme-cli and display temperature using the command line options.

How to install nvme-cli on Linux

Run the following command as per your Linux distro.

Ubuntu/Debian Linux

Type apt command or apt-get command:
sudo apt install nvme-cli
Install nvme-cli on Ubuntu or Debian Linux

Fedora Linux

Execute the following dnf command:
sudo dnf install nvme-cli

CentOS/RHEL 7.x or 8.x

Turn on EPEL repo on a CentOS/RHEL 7.x (see how to enable EPEL repo on a CentOS 8 or enable EPEL repo on an RHEL 8) and run:
sudo yum install nvme-cli
Sample outputs:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.hbcse.tifr.res.in
 * epel: repos.del.extreme-ix.org
 * extras: centos.hbcse.tifr.res.in
 * updates: centos.hbcse.tifr.res.in
Resolving Dependencies
--> Running transaction check
---> Package nvme-cli.x86_64 0:1.8.1-3.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===============================================================================
 Package           Arch            Version                 Repository     Size
===============================================================================
Installing:
 nvme-cli          x86_64          1.8.1-3.el7             base          282 k
 
Transaction Summary
===============================================================================
Install  1 Package
 
Total download size: 282 k
Installed size: 519 k
Is this ok [y/d/N]: y
Downloading packages:
nvme-cli-1.8.1-3.el7.x86_64.rpm                           | 282 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : nvme-cli-1.8.1-3.el7.x86_64                                 1/1 
  Verifying  : nvme-cli-1.8.1-3.el7.x86_64                                 1/1 
 
Installed:
  nvme-cli.x86_64 0:1.8.1-3.el7                                                
 
Complete!

Arch Linux

Type pacman command:
sudo pacman -S nvme-cli

OpenSUSE or Suse Linux

As usual run the zypper command:
sudo zypper install nvme-cli

Alpine Linux

Use apk command as follows
sudo apk add nvme-cli nvme-cli-doc

How do I display NVMe PCI SSD temperature on Linux

First, login as root user using the su command or sudo command:
sudo -i
OR
su -
Now, check NVMe temp in Linux:
sudo nvme smart-log {Device_Name}
sudo nvme smart-log /dev/nvme0
sudo nvme smart-log /dev/nvme1n1

The ‘{Device_Name}’ may be either an NVMe character device. For example, /dev/nvme0) or an nvme block device such as /dev/nvme0n1. Use the grep command to filter out data:
sudo nvme smart-log /dev/nvme0 | grep '^temperature'
Use bash for loop for multiple devices as follows:

 # /dev/nvme0 and /dev/nvme1
for d in /dev/nvme{0..1}
do 
 echo "$d - $(sudo nvme smart-log $d | grep '^temperature')"
done

Linux find NVMe SSD temperature using command line

Conclusion

You learned the nvme Linux command that we used to find NVMe SSD temperature. This command has many more options. See the man page by typing the following man command or visiting the project page online here:
man nvme
nvme help

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive