How to Stress Test CPU in Linux

How to Stress Test CPU in Linux

Stress testing your CPU is one of the best ways to check your processor’s performance capabilities under heavy load and the system’s temperature when that happens.

When you stress test the CPU, you can monitor the system’s resources to see how they behave with the CPU at its peak workload. While the performance will not change compared to what the processor is capable of, the temperature may affect its operation if it is not well-equipped.

Stress testing is essential for enthusiasts when building a new system, especially if you plan to overclock the CPU later.

For instance, if your CPU gets too hot too quickly during the stress test. You need a better cooling solution by changing the CPU cooler, using a better airflow cabinet, etc.

Now that you have an idea about the benefits, I will walk you through the following ways to stress test the CPU in Linux:

  • Using GtkStressTesting (GUI method)
  • Using stress and s-tui utility (CLI method)

So let’s start with the first one.

Stress test Linux CPU using GUI method 🖥️

If you prefer using a GUI solution over the terminal, I have just the easiest method for you to stress-test your system.

There is a GUI utility GtkStressTesting, which helps you stress test and monitor temperature simultaneously. It provides various presets to stress-test the system and provides an ability to choose how many cores you want to work with during the test.

🚧This tool is no more actively maintained on GitLab. But it works as expected.

GtkStressTesting is available as a Flatpak, so if you haven’t already enabled Flatpak support, refer to our Flatpak setup guide.

Once you have enabled Flatpak support, the GtkStressTesting utility can be installed using the following via the terminal (if not software center)

flatpak install flathub com.leinardi.gst

After the installation, you can start the GtkStressTesting utility from the system menu.

Here, I would recommend you click on the Read all button and enter the sudo password so the utility can fetch all the information of your system:

How to Stress Test CPU in Linux

From here, you can choose how long you want to stress test your system (you can always stop the process if the temp gets too high) and choose the max number available in the Workers: Auto.

I went for 12 cores and 5 mins of stress testing:

How to Stress Test CPU in Linux
(Click to enlarge image)

Once you are done, click on the start button and monitor the temperatures, and if they reach beyond 90, stop the stress testing.

My system went to 85 max during stress testing:

How to Stress Test CPU in Linux

Pretty easy way to stress test the CPU. Isn’t it? 😉

Stress test Linux CPU using the Terminal

How to Stress Test CPU in Linux

You’d need two utilities to stress test using a terminal: s-tui and stress.

You can get these tools installed from the default repositories or using pip. It is easier with default repositories if you are okay with using an older version of the tool (a tad bit).

Here are the commands that will help you install them on popular Linux distros:

For Ubuntu/Debian base:

sudo apt install s-tui stress 

For Arch Linux:

sudo pacman -S s-tui stress

For Fedora/RHEL:

sudo dnf install s-tui stress

If you want to use pip for the latest version, here is the command:

pip install s-tui --user

Once you are done with the installation, launch the s-tui utility in the terminal:

s-tui

And you would be met with the following:

How to Stress Test CPU in Linux

You can use the mouse or keyboard arrow keys to navigate through the menu, so click on the Stres options and choose how long you want to stress test the system (in seconds):

How to Stress Test CPU in Linux
(Click to enlarge image)

And finally, select the Stress option, and it will start the stress testing for a specified period:

How to Stress Test CPU in Linux
(Click to enlarge image)

And if the temperature gets out of control, you can click on the Quit button to stop the stress test manually. Additionally, if you want to store the data in the .csv format, the tool gives you the feature.

To store the data, all you have to do is append the -c flag while starting the s-tui utility as shown:

s-tui -c

And if you want to save the file with a name to your liking, you’d have to use the --csv-file flag as shown:

s-tui --csv-file <name of file>.csv

For example, here, I named the file Hello.scv:

s-tui --csv-file Hello.scv

You can explore more about the tool on its GitHub page.

Happy System, Happy Life 😁

Not every user realizes the benefits of a stress test. Sometimes it scares them off with the idea of their system reaching its limits for no reason.

However, the test will help you quickly evaluate and monitor your system’s condition. Things like abnormal temperature spikes and CPU being unable to handle what it is should help you identify hardware issues early on.

In either case, you can refer to our temperature monitoring resource if you want to keep your CPU monitor in check without performing stress tests.

You can also check out some of the system monitoring tools or htop alternatives for Linux to keep an eye on your system resources.

Original Article