How to create a CPU spike with a bash command

后端 未结 23 1259
小蘑菇
小蘑菇 2020-11-30 16:11

I want to create a near 100% load on a Linux machine. It\'s quad core system and I want all cores going full speed. Ideally, the CPU load would last a designated amount of

23条回答
  •  广开言路
    2020-11-30 16:32

    I think this one is more simpler. Open Terminal and type the following and press Enter.

    yes > /dev/null &
    

    To fully utilize modern CPUs, one line is not enough, you may need to repeat the command to exhaust all the CPU power.

    To end all of this, simply put

    killall yes
    

    The idea was originally found here, although it was intended for Mac users, but this should work for *nix as well.

提交回复
热议问题