The Linux kernel utilizes the /sys subsystem to manage and share system information and states, including temperature data. However, this information is not in a consistent location or format, as it varies across different hardware manufacturers and models, as well as the kernel modules responsible for loading the data.

The lm-sensors command-line tool, provided by libsensors, aims to solve this issue by organizing the information into a user-friendly interface. This allows other programs to easily access and configure the data. The lm-sensors utility also includes additional tools for finding and reporting these values.

With lm-sensors, you can conveniently monitor CPU and overall system temperature in Linux using the terminal.

Step-by-step video guide:

Steps to check temperature information in Linux:

  1. Open your preferred terminal application.
  2. Install lm-sensors for 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
  3. Use sensors-detect to probe available sensors in your system.
    $ 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
  4. Start the lm-sensors service if it isn't already running (optional).
    $ sudo systemctl start lm-sensors
  5. Configure the lm-sensors service to automatically start during system 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
  6. View your system's temperature information.
    $ 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

    Harddrive temperature information is not available via lm-sensors but could be viewed using hddtemp.
    Related: How to check hard drive temperature in Linux

  7. Install GUI applications or applets for your desktop environment (optional).
Discuss the article:

Comment anonymously. Login not required.