This article discussed two simple ways to monitor CPU and GPU temperatures on the Linux command line.

Thanks to Steam (including Steam Play, also known as Proton) and other developments, GNU/Linux is becoming the everyday gaming platform of choice for more and more computer users. A significant number of users also use GNU/Linux for resource-consuming computing tasks such as video editing or graphic design (Kdenlive and Blender are good examples of such applications).

Whether you’re one of these users or not, you’re also sure to want to know how hot your COMPUTER’s CPU and GPU can get (especially if you want to overclock). If so, read on. We’ll cover two very simple commands to monitor CPU and GPU temperatures.

My setup consisted of a Slimbook Kymera and two monitors (a TV and a PC monitor), allowing me to use one to play games and the other to keep an eye on the temperature. Also, since I use Zorin OS, I focus on Ubuntu and Ubuntu derivative distributions.

To monitor CPU and GPU behavior, we will dynamically get readings after every few seconds using the practical Watch command.

Monitor CPU temperature in Linux

For CPU temperature, we will use a combination of the Watch and sensors commands. An interesting article on the GRAPHICAL user interface version of this tool has been covered in It’s FOSS. However, we’ll use the command line version here:

watch -n 2 sensors
Copy the code

Watch guarantees that the reading will be updated every 2 seconds (the interval can be changed to suit your needs, of course) :

Sensors iWLwiFI-virtual-0 Adapter: Virtual Device Temp1: +39.0°C ACPITz-virtual-0 Adapter Virtual Device Temp1: +27.8°C (Crit = +119.0°C) Temp2: +29.8°C (Crit = +119.0°C) ISA Adapter Package ID 0: +37.0°C (HIGH = +82.0°C, CRIT = +100.0°C) + 35.0 ° C (high = + 82.0 ° C, crit = + 100.0 ° C) Core: 1 + 35.0 ° C (high = + 82.0 ° C, crit = + 100.0 ° C) Core 2: + 33.0 ° C (high = + 82.0 ° C, crit = + 100.0 ° C) Core: 3 + 36.0 ° C (high = + 82.0 ° C, crit = + 100.0 ° C) Core 4: + 37.0 ° C (high = + 82.0 ° C, crit = + 100.0 ° C) Core 5: + 35.0 ° C (high = + 82.0 ° C, crit = + 100.0 ° C)Copy the code

In addition, we can also get the following information:

  • We have 5 cores in use (and the current maximum temperature is 37.0 ° C).
  • Temperatures above 82.0℃ are considered to be overheating.
  • Temperatures above 100.0℃ are considered to be above the threshold.

Based on the above temperature values we can conclude that my computer currently has a very low workload.

Monitor GPU temperature in Linux

Now let’s look at the graphics card. I’ve never used a GRAPHICS card from AMD, so I’ll focus on Nvidia. The first thing we need to do is download the appropriate latest driver from Ubuntu’s add-on driver.

In Ubuntu (Zorin or Linux Mint is the same), go to Software and Updates > Additional Drivers and select the latest driver available. In addition, you can add or enable the graphics card’s official PPA (either from the command line or through Software and Updates > Other Software). After installing the driver, you will be able to use the “Nvidia X Server” GUI program as well as the command line tool Nvidia-SMI (Nvidia System Management Interface). So we’ll use Watch and NviDIa-SMI:

watch -n 2 nvidia-smi
Copy the code

As with the CPU, we get updated readings every two seconds:

Every 2, 0 s: nvidia-smi Fri Apr 19 20:45:30 2019 +-----------------------------------------------------------------------------+ | Nvidia-smi 418.56 Driver Version: 418.56 CUDA Version: 10.1 | | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | GPU Name Persistence -m | Bus - Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 106... On | Off | 00000000:01:00. 0 N/A | | 0% 54 c | 433 mib P8 10 w / 120 w / 6077 mib 4% Default | | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 1557 G /usr/lib/xorg/Xorg 190MiB | |  0 1820 G /usr/bin/gnome-shell 174MiB | | 0 7820 G ... equest-channel-token=303407235874180773 65MiB | +-----------------------------------------------------------------------------+Copy the code

From this table we get the following information about the display card:

  • It is using an open source driver with version number 418.56.
  • The current temperature of the display card is 54.0℃, and the usage of fans is 0%.
  • The power consumption is very low: just 10W.
  • A total of 6GB of VRAM (video random access memory) was used for 433MB.
  • Vram is being used by three processes with ids 1557, 1820, and 7820.

Most of these facts or numbers clearly show that we are not playing any games that consume system resources or dealing with heavy loads of tasks. These values start to rise when we start playing games, processing videos, or other similar tasks.

conclusion

Even though we had GUI tools, I found these two commands very handy for monitoring hardware in real time.

How will you use them? You can learn more about using these tools by reading their MAN manual.

What other tools do you prefer? Share them with us in the comments;) .

Have fun!


Via: itsfoss.com/monitor-cpu…

Author: Alejandro Egea-Abellan (Lujun9972

This article is originally compiled by LCTT and released in Linux China