how to set cpu usage to 100% linux
top -bn1 | grep "Cpu(s)" | \
sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \
awk '{print 100 - $1"%"}'
0
0
cat /proc/cpuinfo
Thank you!
0
0
3.75
8
$ sudo cpulimit --pid 17918 --limit 50
Process 17918 detected
Thank you!
8
0
4
8
awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' \
<(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat)
Thank you!
8
0
Are there any code examples left?
New code examples in category Shell/Bash