Install stress Command on Ubuntu 20.04

Install stress Command on Ubuntu 20.04

The stress is a tool that enables to generate a workload on the system via command line. This allows to configure amount of load on CPU, memory, and I/O.

This tutorial demonstrates how to install stress on Ubuntu 20.04.

Install stress

Make sure the package lists are up-to-date:

sudo apt update

Execute the following command to install stress:

sudo apt install -y stress

Once installation is completed, we can check stress version:

stress --version

Testing stress

Execute the stress command and provide a --cpu option and the number of workers to perform CPU stress testing. When --cpu option is provided, a workload is generated by using sqrt function. Stress testing is stopped after N seconds which can be specified with --timeout option.

We can use uptime command to determine the average system load before and after running a stress command.

sudo stress --cpu 2 --timeout 10

An example of output:

CPU stress testing using stress command on Ubuntu

Uninstall stress

If you decided to completely remove stress, run the following command:

sudo apt purge --autoremove -y stress

Leave a Comment

Cancel reply

Your email address will not be published.