Because of Steam (including Steam Play, aka Proton) and other developments, GNU/Linux is becoming the gaming platform of choice for more and more computer users every day.
A good number of users are also going for GNU/Linux when it comes to other resource-consuming computing tasks such as video editing or graphic design (Kdenlive and Blender are good examples of programs for these).
Whether you are one of those users or otherwise, you are bound to have wondered how hot your computer’s CPU and GPU can get (even more so if you do overclocking). If that is the case, keep reading. We will be looking at a couple of very simple commands to monitor CPU and GPU temps.
Since we are talking about commands, you may want to learn how to get GPU details in Linux command line.
My setup includes a Slimbook Kymera and two displays (a TV set and a PC monitor) which allows me to use one for playing games and the other to keep an eye on the temperatures. Also, since I use Zorin OS I will be focusing on Ubuntu and Ubuntu derivatives.
To monitor the behaviour of both CPU and GPU we will be making use of the watch command to have dynamic readings every certain number of seconds.
Monitoring CPU Temperature in Linux
For CPU temps, we will combine sensors with the watch command. The sensors command is already installed on Ubuntu and many other Linux distributions. If not, you can install it using your distribution’s package manager. It is available as sensors or lm-sensors package.
An interesting article about a gui version of this tool to check CPU temperature has already been covered on It’s FOSS. However, we will use the terminal version here:
watch -n 2 sensors
The watch command guarantees that the readings will be updated every 2 seconds (and this value can — of course — be changed to what best fit your needs):
Every 2,0s: 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)
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +37.0°C (high = +82.0°C, crit = +100.0°C)
Core 0: +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)
Amongst other things, we get the following information:
- We have 6 cores in use at the moment (with the current highest temperature being 37.0ºC).
- Values higher than 82.0ºC are considered high.
- A value over 100.0ºC is deemed critical.
The values above lead us to conclude that the computer’s workload is very light.
If you are interested, there is an advanced tool called CoreFreq that you can use to get detailed CPU information.
Monitoring GPU Temperature in Linux
Let us turn to the graphics card now. I have never used an AMD dedicated graphics card, so I will be focusing on Nvidia ones. The first thing to do is download the appropriate, current driver through additional drivers in Ubuntu.
On Ubuntu (and its derivatives such as Zorin or Linux Mint), going to Software & Updates > Additional Drivers and selecting the most recent one normally suffices.
Additionally, you can add or enable the official graphics PPA (either through the command line or via Software & Updates > Other Software ).
After installing the driver you will have at your disposal the Nvidia X Server gui application along with the command line utility nvidia-smi
(Nvidia System Management Interface). So we will use watch
and nvidia-smi
:
watch -n 2 nvidia-smi
And — the same as for the CPU — we will get updated readings every two seconds:
Every 2,0s: 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... Off | 00000000:01:00.0 On | N/A |
| 0% 54C P8 10W / 120W | 433MiB / 6077MiB | 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 |
+-----------------------------------------------------------------------------+
The chart gives the following information about the graphics card:
- it is using the open source driver version 418.56.
- the current temperature of the card is 54.0ºC — with the fan at 0% of its capacity.
- the power consumption is very low: only 10W.
- out of 6 GB of vram (video random access memory), it only uses 433 MB.
- the used vram is being taken by three processes whose IDs are — respectively — 1557, 1820 and 7820.
Most of these facts/values show that — clearly — I am not playing any resource-consuming games or dealing with heavy workloads. Should I start playing a game, processing a video — or the like — the values would increase.
Conclusion
Although there are GUI tools, these two commands are very handy for checking your hardware in real-time.
What do you make of them? You can learn more about the utilities involved by reading their man pages.
Do you have other preferences? Share them with us in the comments, ;).
Halof!!! (Have a lot of fun!!!).