The Linux kernel provides system information, including thermal data, through the /sys directory. This data, however, is not always easy to find, as its location depends on hardware manufacturers and kernel versions. Each system might store temperature and sensor information in different formats, making manual monitoring difficult.
The lm-sensors tool simplifies this process by detecting sensors across your system and organizing their data in a readable format. It probes the hardware, loads the required modules, and allows you to monitor the CPU, system temperature, and fan speeds. It makes checking system health through the command line straightforward without the need for digging through various system files.
With the help of lm-sensors, you can easily monitor temperature information from the terminal. In addition, tools like acpi can provide deeper thermal readings. This makes it practical for users who need consistent access to hardware monitoring, regardless of the specific Linux distribution they are using.
Steps to check temperature information in Linux:
- Open your terminal.
- Install lm-sensors on your system.
$ sudo pacman -S lm_sensors # Mint $ sudo yum install --assumeyes lm_sensors #Red Hat, CentOS $ sudo dnf install lm_sensors # Fedora $ sudo apt update && sudo apt install --assume-yes lm-sensors # Ubuntu, Debian $ sudo zypper in sensors #SUSE
- Run sensors-detect to detect available sensors.
$ sudo sensors-detect --auto # sensors-detect revision $Revision$ # System: Dell Inc. Latitude E5470 (laptop) # Board: Dell Inc. 0VHKV0 # Kernel: 5.0.0-20-generic x86_64 # Processor: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (6/78/3) Running in automatic mode, default answers to all questions are assumed. Some south bridges, CPUs or memory controllers contain embedded sensors. Do you want to scan for them? This is totally safe. (YES/no): Module cpuid loaded successfully. Silicon Integrated Systems SIS5595... No VIA VT82C686 Integrated Sensors... No VIA VT8231 Integrated Sensors... No AMD K8 thermal sensors... No AMD Family 10h thermal sensors... No AMD Family 11h thermal sensors... No AMD Family 12h and 14h thermal sensors... No AMD Family 15h thermal sensors... No AMD Family 16h thermal sensors... No AMD Family 17h thermal sensors... No AMD Family 15h power sensors... No AMD Family 16h power sensors... No Intel digital thermal sensor... Success! (driver `coretemp') ##### snipped Client found at address 0x52 Probing for `Analog Devices ADM1033'... No Probing for `Analog Devices ADM1034'... No Probing for `SPD EEPROM'... Yes (confidence 8, not a hardware monitoring chip) Next adapter: i915 gmbus dpc (i2c-1) Do you want to scan it? (yes/NO/selectively): Next adapter: i915 gmbus dpb (i2c-2) Do you want to scan it? (yes/NO/selectively): Next adapter: i915 gmbus dpd (i2c-3) Do you want to scan it? (yes/NO/selectively): Next adapter: DPDDC-A (i2c-4) Do you want to scan it? (yes/NO/selectively): Next adapter: DPDDC-C (i2c-5) Do you want to scan it? (yes/NO/selectively): Now follows a summary of the probes I have just done. Driver `coretemp': * Chip `Intel digital thermal sensor' (confidence: 9) To load everything that is needed, add this to /etc/modules: #----cut here---- # Chip drivers coretemp #----cut here---- If you have some drivers built into your kernel, the list above will contain too many modules. Skip the appropriate ones! Do you want to add these lines automatically to /etc/modules? (yes/NO) Unloading cpuid... OK
- Start the lm-sensors service if it isn't already running (optional).
$ sudo systemctl start lm-sensors
- Enable lm-sensors service to start at boot.
$ sudo systemctl enable lm-sensors Synchronizing state of lm-sensors.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable lm-sensors
- Check system temperature and sensor data.
$ sensors iwlwifi-virtual-0 Adapter: Virtual device temp1: +32.0°C pch_skylake-virtual-0 Adapter: Virtual device temp1: +33.0°C acpitz-acpi-0 Adapter: ACPI interface temp1: +25.0°C (crit = +107.0°C) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +34.0°C (high = +100.0°C, crit = +100.0°C) Core 0: +34.0°C (high = +100.0°C, crit = +100.0°C) Core 1: +34.0°C (high = +100.0°C, crit = +100.0°C) dell_smm-virtual-0 Adapter: Virtual device Processor Fan: 0 RPM CPU: +34.0°C Ambient: +31.0°C SODIMM: +33.0°C Other: +32.0°C
Hard drive temperature is not available via lm-sensors. Use hddtemp for hard drive temperature monitoring
Related: How to check hard drive temperature in Linux - Install GUI applications or applets for your desktop environment (optional).
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.