How to create 100% CPU load in Linux

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.

  1. Open your favorite terminal app. Mine is xfce4-terminal.
  2. Identify how many cores and threads your CPU has. You can get detailed CPU info with the following command:
    cat /proc/cpuinfo

     

    It prints out information about all CPUs, including physical and virtual.

    cpu-info-1
    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:cpu-info-2

  3. 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.create-cpu-load-linux

Voila, you have loaded your CPU at 100%. See the following screenshot:100-percent-load

To stop it, execute the command killall yes as root.cancel-test

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

Advertisment

2 thoughts on “How to create 100% CPU load in Linux

  1. Dennis Faucher

    That’s brilliant. Thank you. I have been using stress-ng but that package is not supported on Photon OS. This is perfect.

    Reply
  2. Randy Kolmer

    Thanks man. Exactly what I was looking for. No need to install additional softwares, simple and works like a charm.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *