Sometimes it is useful to stress out your CPU. For example, if you have replaced your CPU fan or changed something in the cooling system, it is a good idea to test it under heavy load. Here is a trick you can use to overload your CPU in Linux.
One of great options of the Linux operating system is the amount of useful tools available out of the box even in the base system. Thanks to the "everything-is-a-filesystem" concept used when designing Linux, you don't need extra tools to stress out your CPU.
How to create a 100% CPU load in Linux
To create a 100% CPU load on your Linux PC, do the following.
- Open your favorite terminal app. Mine is xfce4-terminal.
- Identify how many cores and threads your CPU has. You can get detailed CPU info with the following command:
It prints out information about all CPUs, including physical and virtual.
Notice the "Processor" line for every information section. It has a value starting from 0 and ending at the number of cores/threads. In my case, it shows 4 CPUs, which matches my dual core i3 with 2 threads per core.
Alternatively, you can use something like the htop utility, it shows the same information using bars:
- Next, execute the following command as root:
# yes > /dev/null &
Repeat the command N times, where N is the number of CPUs. In my case, I have to execute it four times.
Voila, you have loaded your CPU at 100%. See the following screenshot:
To stop it, execute the command killall yes as root.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
2 thoughts on “How to create 100% CPU load in Linux”
That’s brilliant. Thank you. I have been using stress-ng but that package is not supported on Photon OS. This is perfect.
Thanks man. Exactly what I was looking for. No need to install additional softwares, simple and works like a charm.