[Linux tips] One-line command to get CPU usage up to 100%

Source: Internet
Author: User
Tags cpu usage

For i in ' SEQ 1 $ (cat/proc/cpuinfo |grep "Physical id" |wc-l) '; Do DD If=/dev/zero Of=/dev/null & Done


Description

Cat/proc/cpuinfo |grep "Physical ID" | Wc-l can get the number of CPUs, which we represent as N.

SEQ 1 n is used to generate numbers between 1 and N

For i in ' seq 1 N '; is the Loop Run command, from 1 to n

DD If=/dev/zero of=/dev/null Run the DD command, output to/dev/null, actually consumes only CPU, no IO operation.

Because the DD command that runs N (n is the number of CPUs) continuously and uses 100%, the scheduler dispatches each DD command to be processed on a different CPU.

Finally achieve full CPU utilization 100%


Other than that. The end of the above procedure can be used:

1. Press CTRL + C after FG (because the command is running in the background)

2. pkill-9 DD

[Linux tips] One-line command to get CPU usage up to 100%

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.