Linux command to create 100% cpu loading

We can use below command to generate cpu loading in linux

yes > /dev/null &

Notes:

  • “yes” is a command to print “yes” to screen repeatedly
  • /dev/null is data sink ,which means the output of command “yes” will be discareded
  • “&” means let this command to be running in background
  • One above command will use up one cpu core (or Hyper Thread)

You can use command “cat /proc/cpuinfo” to check how many cpus you have, eg: if you have 4 cpus (probably 1 cpu with 2 cores and each core have 2 threads) , then you need to run 4 above command to make your cpu 100% busy

You can use below command to kill these commands

killall yes

Leave a Reply

Your email address will not be published. Required fields are marked *