Introduction / Why This Matters
stress-ng is a modern replacement for the classic stress utility, specifically designed for comprehensive Linux stability testing. The tool generates controlled load on the CPU, RAM, disk subsystem, network, and hardware caches. It is indispensable for testing new servers, validating overclock stability, verifying cooling system performance, or debugging the kernel task scheduler.
By the end of this guide, you will have a fully functional utility and learn how to safely run stress tests without risking a permanent system freeze.
Prerequisites / Preparation
Before you begin, ensure you have:
- Terminal access with superuser privileges (
sudoorroot) - A stable internet connection for downloading packages
- A Linux distribution based on Debian, Ubuntu, Fedora, Arch, or their derivatives
⚠️ Important: Running prolonged stress tests on laptops plugged into AC power without adequate cooling can lead to thermal throttling or emergency shutdowns. Monitor CPU temperatures in parallel using
sensorsorhtop.
Step 1: Update the Package Cache
Before installing new software, synchronize your local package indexes with the repositories. This prevents version conflicts and "package not found" errors.
# For Debian/Ubuntu
sudo apt update
# For Fedora/RHEL
sudo dnf check-update
# For Arch/Manjaro
sudo pacman -Sy
Step 2: Install via Package Manager
stress-ng is available in the default repositories of most modern distributions. Run the command that matches your system:
# Debian/Ubuntu
sudo apt install stress-ng -y
# Fedora
sudo dnf install stress-ng -y
# Arch Linux
sudo pacman -S stress-ng --noconfirm
The package manager will automatically resolve dependencies and place the binaries in /usr/bin/.
Step 3: Verify the Installation
Ensure the utility installed successfully and is available in your $PATH environment variable.
stress-ng --version
The output should display a version number (e.g., stress-ng 0.16.04). If the system returns command not found, check the installation logs for dependency errors and repeat Step 2.
Step 4: First Run and Stress Test
Let's safely put the system under load for a short period. The --cpu 0 option utilizes all available logical cores, while --timeout 10s automatically stops the test after 10 seconds.
stress-ng --cpu 0 --timeout 10s --metrics-brief
The --metrics-brief flag outputs statistics on the number of operations (bogo ops) and execution time, which is useful for quickly assessing performance without cluttering the console.
Verifying the Results
Once the test completes, a summary table will appear in the terminal. Pay attention to the bogo ops/s column—it shows the average rate of test operations. The higher the value, the more stable the system is under load.
If you need to interrupt the test before the timeout expires, simply press Ctrl + C in the active terminal window. The utility will gracefully terminate child processes, clean up temporary files, and free memory.
Common Issues
Permission deniederror when accessing sockets or/proc/sys/...: Some metrics require access to system parameters. Run the command withsudoif you are testing network interfaces or the filesystem.- System freezes or the OOM-killer triggers: You allocated too many threads for RAM. Reduce the load parameter, for example
--vm 2 --vm-bytes 75%, and always use--timeoutfor automatic termination. - Package missing from the official repository: For older or minimal Linux builds, compile the utility from source by downloading the archive from the official GitHub release, or enable the EPEL repository on RHEL-compatible systems.