11

Is there a way to see the CPU temperature in htop. I am using windows10 wsl, so I'm not sure if WSL1 has access to CPU temperature reading.

K7AAY
  • 17,735
  • I am not familiar with WSL, but what about the sensors command? – FedKad Dec 19 '19 at 17:07
  • its WSL1 @K7AAY – Patoshi パトシ Dec 19 '19 at 17:28
  • 2
    The Linux kernel tools for interfacing with hardware don't currently work in WSL, since WSL does not use a Linux kernel. Since Windows is the OS in control of the hardware, you will have best luck using Windows tools to control and monitor that hardware. Obviously, Linux hardware tools work very well when you boot into Linux. – user535733 Dec 19 '19 at 17:40
  • it looks like the new WSL 2 has a linux kernal. @user535733 – Patoshi パトシ Dec 19 '19 at 20:36
  • 1
    @Patoshiパトシ https://docs.microsoft.com/en-us/windows/wsl/wsl2-install seems quite clear that WSL is virtualized. The virtualized kernel, Linux (WSL2) or not (WSL1), has no access to the real hardware. It can only see the virtual platform that Windows provides. Whether or not Windows provides an API to simulate hardware access seems more like a Windows support question. – user535733 Dec 19 '19 at 20:40

2 Answers2

7

htop provides temperature data via libsensors. This feature is a build-time option. https://github.com/htop-dev/htop#linux

  • Suprised to learn this. Installed lm-sensors and libsensors-dev through apt, then went into the htop setup menu (press F2) > Display options > also show CPU temperature. Seems the htop from apt is already compiled with this – walnut_salami Dec 04 '21 at 13:50
2

A review of the man page for htop does not show it has that ability. It is a process viewer, not designed to read sensors.

K7AAY
  • 17,735
  • 2
    In its current state, this answer was true for Ubuntu 18.04 LTS but on on 22.04 LTS htop is built with sensors support: https://manpages.ubuntu.com/manpages/jammy/en/man1/htop.1.html (CTRL+F libsensors) – walnut_salami Dec 04 '21 at 13:53