To read the CPU temperature, voltage, and fan speed on a Linux system using the lm-sensors
utility, you need to first install the lm-sensors
package.
To install lm-sensors
, you can use your system's package manager. For example, on a Debian or Ubuntu system, you can use the apt-get
command:
sudo apt-get install lm-sensors
On a CentOS or Fedora system, you can use the yum
command:
sudo yum install lm-sensors
Once the lm-sensors
package is installed, you can use the sensors
command to read the CPU temperature, voltage, and fan speed.
For example, to read the temperature of the CPU, you can use the following command:
sensors | grep "Core"
This will show the temperature of each CPU core.
To read the voltage of the CPU, you can use the following command:
sensors | grep "VCore"
To read the fan speed of the CPU, you can use the following command:
sensors | grep "fan"
Note: The exact names of the sensors and the output format may vary depending on your system's hardware and the lm-sensors
configuration. You can use the sensors-detect
command to detect the available sensors and configure lm-sensors
accordingly.