How to Use the Command 'sensors' (with Examples)
- Linux
- December 17, 2024
The sensors
command is an essential tool used primarily on Linux systems to monitor various hardware components’ vital statistics. It provides detailed information about system temperatures, coolers, battery status, and other sensor data available through the machine’s hardware monitoring chips. This command, often in combination with system utilities, helps in maintaining the health and efficiency of your computer by keeping tabs on your device’s internal environment.
Use Case 1: Show the Current Readings of All Sensor Chips
Code:
sensors
Motivation:
The primary reason for using the sensors
command without any additional arguments is to gather a comprehensive snapshot of all sensor readings from your computer’s hardware components at a glance. This includes, but is not limited to, CPU temperature, motherboard temperature, fan speeds, and voltages. Therefore, executing this command is particularly beneficial for system administrators or users engaged in performance tuning, overclocking, or just those who want to ensure their systems are operating within safe temperature and voltage limits.
Explanation:
- The command
sensors
is invoked without additional arguments, relying on the system’s configuration to gather and display available sensor data. This straightforward execution mode is perfect for users who require a quick overview of all sensors without the need to convert measures to specific units or isolate particular data sets.
Example Output:
acpitz-virtual-0
Adapter: Virtual device
temp1: +47.0°C
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +42.0°C (high = +100.0°C, crit = +100.0°C)
Core 1: +45.0°C (high = +100.0°C, crit = +100.0°C)
pch_cannonlake-virtual-0
Adapter: Virtual device
temp1: +42.0°C
The output provides readings such as chip/module names, associated adapters, and specific environmental data like temperatures in Celsius, each tailored to the respective hardware component’s specifications.
Use Case 2: Show Temperatures in Degrees Fahrenheit
Code:
sensors --fahrenheit
Motivation:
Using the --fahrenheit
argument with the sensors
command is especially useful for users in regions where the Fahrenheit scale is more culturally prevalent and thus more intuitive than Celsius. By converting temperature measurements to Fahrenheit, this use case ensures that users can more readily comprehend and react to the sensor data being reported, which is crucial for effective monitoring and maintenance.
Explanation:
- The argument
--fahrenheit
is specified, telling thesensors
command to convert all temperature readings from the default Celsius to Fahrenheit, aligning the output with the user’s preferred temperature scale. This allows users to avoid manual conversions and simplifies their monitoring tasks significantly.
Example Output:
acpitz-virtual-0
Adapter: Virtual device
temp1: +116.6°F
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +107.6°F (high = +212.0°F, crit = +212.0°F)
Core 1: +113.0°F (high = +212.0°F, crit = +212.0°F)
pch_cannonlake-virtual-0
Adapter: Virtual device
temp1: +107.6°F
The output mirrors the format seen in the Celsius-only reading, with temperatures now conveyed in the Fahrenheit scale, making it accessible and immediately useful for users accustomed to this unit of measure.
Conclusion
The sensors
command is an invaluable utility in the toolkit of any Linux user keen on system monitoring and management. By providing vital hardware data through a simple command line interface, this tool enables users to effortlessly track their system’s performance metrics. The command displays information in default Celsius form or user-preferred Fahrenheit scales, demonstrating its adaptability and user-friendliness across different regions and user preferences. Whether for daily operations or specialized hardware tuning tasks, sensors
delivers essential insights to ensure system stability and prevent hardware failures.