On Windows, one can install CrystalDiskInfo and check the S.M.A.R.T info such as the remaining life of a SSD / M2 drive easily. This article will introduce a software called smartmontools. It provides similar function to CrystalDiskInfo on your Linux devices and can be executed on CLI only server. On Ubuntu 22.04, install smartmontools by
sudo apt install smartmontools -y
An example command to check your SSD / M2 drive S.M.A.R.T info.
sudo smartctl -a /dev/sda