How to use the command 'sensors' (with examples)
- Linux
- December 25, 2023
The ‘sensors’ command is used to report sensors information on a Linux system. It provides readings for various hardware sensors, such as CPU temperature, fan speed, and voltage. This information can be useful for monitoring hardware health and troubleshooting temperature-related issues.
Use case 1: Show the current readings of all sensor chips
Code:
sensors
Motivation: This use case allows users to quickly check the current readings of all sensor chips on their system. It provides an overview of the hardware sensor data, allowing users to monitor temperature, fan speed, and voltage.
Explanation: The command ‘sensors’ without any additional arguments will display the current readings of all available sensor chips in the system. The output will contain information such as chip name, temperature values, fan speed, and voltage.
Example output:
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +45.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +43.0°C (high = +100.0°C, crit = +100.0°C)
Core 1: +45.0°C (high = +100.0°C, crit = +100.0°C)
acpitz-acpi-0
Adapter: ACPI interface
temp1: +27.8°C
nouveau-pci-0100
Adapter: PCI adapter
fan1: 1116 RPM
Use case 2: Show temperatures in degrees Fahrenheit
Code:
sensors --fahrenheit
Motivation: This use case allows users to view the temperatures in degrees Fahrenheit instead of the default Celsius. Some users may be more comfortable with Fahrenheit or may require temperature values in this unit for specific purposes.
Explanation: Adding the argument ‘–fahrenheit’ to the ‘sensors’ command will display the sensor readings in degrees Fahrenheit instead of Celsius. This conversion can be helpful for users who are more familiar with Fahrenheit or need the temperature values in this unit.
Example output:
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +113.0°F (high = +212.0°F, crit = +212.0°F)
Core 0: +109.4°F (high = +212.0°F, crit = +212.0°F)
Core 1: +113.0°F (high = +212.0°F, crit = +212.0°F)
acpitz-acpi-0
Adapter: ACPI interface
temp1: +82.0°F
nouveau-pci-0100
Adapter: PCI adapter
fan1: 1116 RPM
Conclusion:
The ‘sensors’ command is a powerful tool for retrieving hardware sensor information in a Linux system. It provides a detailed report on temperatures, fan speeds, and voltages, allowing users to monitor and diagnose any potential issues. The ability to switch between Celsius and Fahrenheit units provides flexibility to meet individual user preferences or specific requirements.