====== Ubuntu - CPU - Create 100% CPU Load ====== To stress test and benchmark certain key aspects of it including CPU performance. ---- ===== Install Stress or Stress-ng ===== sudo apt install stress or sudo apt install stress-ng **NOTE:** **stress-ng** is a newer version of stress that ships in with extra features. ---- ===== Impose 100% CPU Load ===== Run **stress** or **stress-ng**. sudo stress-ng --cpu 4 -v --timeout 30s **NOTE:** where * **--cpu**: Specifies the number of cores. * **-v**: Enables verbose mode. * **--timeout**: Specifies the time after which the command will terminate. ---- ===== Check CPU usage ===== top ---- ===== Other methods to create 100% CPU load ===== yes > /dev/null & **NOTE:** This only imposes 100% load on a single core. To impose this against multiple cores, then run the command multiple times to exhaust all the CPU power: yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & **NOTE:** To terminate the Linux background jobs created by the above commands: killall yes ---- ===== Another method to produce 100% CPU load usage ===== dd if=/dev/zero of=/dev/null To fully utilize all the cores on your system, run the following command: fulload() { dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null & }; fulload; read; killall dd **NOTE:** The number of the above command in the function should be equal to the number of cores (for example 4 in this case). ----