There are many reasons why you might want to stress test your Linux system. System administrators may want to see how their operating system and hardware perform under full load to detect software bugs or hardware failures.
In this codelab you will learn
This is the OS of the virtual machine. This will be Debian .
By default, administrator privileges are required on the Host OS to install additional software. Make sure that you have the required permissions.
For the Guest OS, you will create and manage your own users. These users will therefore be different from the Host's user administration.
This one-liner creates a yes process that runs on each processor core of the machine. The yes command repeatedly prints the letter y until it terminates. It uses 100% of a CPU core. If Hyper-Threading is enabled, twice as many yes processes will be created.
Open a shell and run the following one-liner:
for i in $(seq $(getconf _NPROCESSORS_ONLN)); do yes > /dev/null & done
The output of this one-liner will look this:

The command getconf _NPROCESSORS_ONLN returns the number for CPU cores. The command seq prints a sequence of numbers from 1 up to the amount of CPU Cores. FInally, the look for i in .... done takes the sequence and starts a yes process for each of them, redirecting the output to dev/null.
As a result, the command htop shows the CPU utilization:

To kill all yes processes, run the following one-liner:
killall yes
Description
The stress program is a simple workload generator for POSIX systems. It allows system administrator to run a configurable amount of CPU, memory, disk and I/O stress on the target system.
Open a shell and run the following command with root privileges:
stress -c 1 -t 60s -v
Where,
-c 1 : Run one (1) worker spinning on sqrt()-t 60s : Timeout after 60 seconds-v : Be verboseThe output will look like this:

To see how the stress commmand utilize the CPU, open a shell and start the htop application:
htop
The output will look something like this: 
Open a shell and run the following command with root privileges:
stress -m 2 --vm-bytes 1024M -t 20s -v
Where,
-m 2 : Run two (2) workers spinning on sync()--vm-bytes 1024M : malloc 1024MB per vm worker-t 20s : Timeout after 20 secondsTo see how the stress commmand utilize Memory, open a shell and start the htop application:
htop
The output will look like this: 
Stressing the manual page:
man stress