How to install sensors (lm-sensors) on Ubuntu / Debian Linux

See all Ubuntu Linux related FAQ
The lm-sensors package on your Debian and Ubuntu Linux system is used for hardware health monitoring. What kind of information one can see with the sensors command? For example, the users can see CPU temperature, voltage, fan speed sensors. Using the command-line options, let us see how to install and use lm-sensors on your Debian or Ubuntu Linux system.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux terminal
Category Package Manager
OS compatibility Debian Linux Mint Pop!_OS Ubuntu
Est. reading time 4 minutes
Advertisement

Installing install sensors (lm-sensors) on Ubuntu / Debian Linux

  1. Open the terminal application.
  2. For remote bare metal server use the ssh command for management purpose. For example:
    $ ssh user@server-name-here
  3. Search for the lm-sensors package. Therefore, run apt-cache command:
    $ apt-cache search ^lm-sensors
  4. Get information about the sensors package on Ubuntu / Debian Linux, run:$ apt info lm-sensors
    Searching for lm-sensors package on Debian or Ubuntu Linux

    Show information about the given package

  5. Install the lm-sensors package on your Debian or Ubuntu Linux machine, type apt command:
    $ sudo apt install lm-sensors
    Installing sensors (lm-sensors) on Ubuntu or Debian Linux using apt get command

    Using apt-get to install package on your machine

  6. The sensors-detect is an interactive command. It will walk you through scanning your system for various hardware monitoring chips installed on your motherboard. Hence, next configure the sensors, type:$ sudo sensors-detect
    Debian or Ubuntu Linux detect hardware monitoring chips

    Detecting hardware monitoring chips under Linux

  7. At the end you will see message as follows on the screen:
    Now follows a summary of the probes I have just done.
    Just press ENTER to continue: 
     
    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)YES
    Successful!
     
    Monitoring programs won't work until the needed modules are
    loaded. You may want to run '/etc/init.d/kmod start'
    to load them.
     
    Unloading cpuid... OK
  8. Restart the kmod service using the systemctl command:$ sudo systemctl restart kmod
  9. So far, so good. Now that you have installed the package and configured the system. The next step is to read the data. Then to get CPU temperature/voltage/fan sensors, run: $ sensors

Understanding sensors (lm-sensors) outputs

Take a look at the following outputs:
First step is to install lm-sensors and get data
I see the following information:

  • coretemp-isa-0000 – CPU core temperature
  • thinkpad-isa-0000 – Thinkpad laptop fan speed
  • nvme-pci-0300 – NVIDIA GPU temperature data
  • BAT0-acpi-0 – Laptop battery (ACPI) voltage
  • ucsi_source_psy_USBC000:001-isa-0000 – Plugged in USB device voltage readings
  • iwlwifi_1-virtual-0 – Intel WiFi temperature data

Printing the temperatures in degrees Fahrenheit instead of Celsius

Pass the -f option:
$ sensors -f
## OR ##
$ sensors --fahrenheit

Getting JSON output

Want to phrase the sensors command outputs in Python or Perl? Try the JSON output. Therefore, run the following output is suitable for scripting in Perl or Python:
$ sensors -j
$ sensors -j | jq ...

Summing up

This quick tutorial explained how to install the sensors (lm-sensors) package on your Ubuntu, Mint or Debian Linux using the CLI. Further, you learned how to read and print sensors information on the screen. These commands have other options too. Hence, consult the following manual pages for more information using the man command or help command as follows:
$ man 1 sensors
$ man 8 sensors-detect
$ man 5 sensors.conf

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

5 comments… add one
  • zeeproduction Feb 14, 2023 @ 1:29

    Yes. This was helpful for me. I have a few systems running the same distro and one of them was not showing sensors info on Sys. Reports. I had a message like “is the sensors app installed?” and I started to dig. I came to this post and went through the steps. Now I have information on all things and keep an eye on the health of my system. I wonder how this one did not have sensors module installed and the other did. But that’s something not for here I suppose. Thanks a lot.

  • zlaam Apr 9, 2024 @ 15:41

    Helpful

  • Alex Apr 23, 2024 @ 9:05

    AMD Ryzen 9 7940hs no one sensors detected.

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Apr 23, 2024 @ 9:33

      a) Make sure you have the most recent stable Linux kernel installed.
      b) Install all bios updates too

  • Wendy Apr 28, 2024 @ 12:35

    I’m using Gentoo Linux building my own kernel. Always a challenge to find out which sensor drivers I need.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.