After installation, run the following command to detect available sensors:
sudo sensors-detect
You will be prompted with several questions; you can generally accept the defaults by pressing Enter.
Step 3: View CPU temperature
Once the sensors are detected, you can view the CPU temperature by running:
sensors
This command will display a summary of temperatures and other sensor information.
2. Using psensor
psensor is a graphical application, but it can also be installed to show temperatures in the command line.
Step 1: Install psensor
You can install it using:
sudo apt install psensor
Step 2: Use psensor
After installing, you can run the graphical interface or check CPU temperatures through the command line using:
psensor
3. Using /proc filesystem
For a quick check, you can also read CPU temperature directly from the /proc filesystem (though this may depend on support in the kernel):
cat /proc/acpi/thermal_zone/THRM/temperature
Note: The exact path may vary based on your hardware and kernel version.
4. Using hardinfo
You can also use hardinfo, which provides system information, including temperature:
sudo apt install hardinfo
hardinfo -r
This will provide a graphical interface, but the command will also give you access to system information.
Conclusion
Using lm-sensors is the most common way to view CPU temperature in the command line in Ubuntu. You can install it and use the commands above to get temperature readings efficiently.