You can use either the tlp
or thermald
softwares, or both.
TLP is an advanced power management tool for Linux. It comes with a
default configuration already optimized for battery life. At the same
time it is highly customizable to fulfil specific user requirements.
sudo apt install tlp
Thermal Daemon is a Linux daemon for monitoring and
controlling platform temperatures. Once the system
temperature reaches a certain threshold, the Linux daemon
activates various cooling methods to try to cool the system.
sudo apt install thermald