How to create a CPU spike with a bash command
Posted on: 26 July 2014 /
Categories:
Generate CPU spikes near to 100% load on a Linux machine. You can ran the following command in bash:
To generate cpu spike :
# dd if=/dev/zero of=/dev/null
To run the command on put load on more cores run the 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
You can also make use of the stress tool “stress”
# stress --cpu 2 --timeout 60
To find more about this command go to linux.die.net