Linux kernel uses /sys subsystem for communication. Information about hardware and temperature informations could be obtained from the subsystem, with the caveat that the information is not in standard location and format as it differs between hardware models/manufacturers and its associated kernel module.

lm-sensors via its libsensors try to address the issue by mapping these informations into an easily accessible interface for other programs to read and configure the values. It also provides userland tools for finding and reporting these values.

You can use lm-sensors to view temperature information in Linux via these steps:

  1. 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 install --assume-yes lm-sensors #Ubuntu, Debian
    $ sudo zypper in sensors #SUSE
  2. Detect available sensors in your system.
    $ sudo sensors-detect
    # sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)
    # Kernel: 4.14.79-v7+ armv7l
    # Processor: ARMv7 Processor rev 4 (v7l) (//)
    This program will help you determine which kernel modules you need
    to load to use lm_sensors most effectively. It is generally safe
    and recommended to accept the default answers to all questions,
    unless you know what you're doing.
    Some south bridges, CPUs or memory controllers contain embedded sensors.
    Do you want to scan for them? This is totally safe. (YES/no):
    modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules
    modprobe: FATAL: Module cpuid not found in directory /lib/modules/4.14.79-v7+
    Failed to load module cpuid.
    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 15h power sensors...                             No
    AMD Family 16h power sensors...                             No
    AMD Family 15h power sensors...                             No
    AMD Family 16h power sensors...                             No
    Intel digital thermal sensor...                             No
    Intel AMB FB-DIMM thermal sensor...                         No
    Intel 5500/5520/X58 thermal sensor...                       No
    VIA C7 thermal sensor...                                    No
    VIA Nano thermal sensor...                                  No
    Lastly, we can probe the I2C/SMBus adapters for connected hardware
    monitoring devices. This is the most risky part, and while it works
    reasonably well on most systems, it has been reported to cause trouble
    on some systems.
    Do you want to probe the I2C/SMBus adapters now? (YES/no):

    Gathered sensor informtions are stored in /etc/conf.d/lm_sensors

  3. Start lm_sensors service if it's not already started (optional).
    systemctl status lm_sensors
  4. Retrieve temperature information for your system.
    $ sensors

    Available informations include:

    • CPU temp
    • fan speed

    Harddrive temperature information for Linux is provided by hddtemp

  5. Install GUI applications or applets for your desktop environment (optional).