How to generate CPU load on Linux server

Solution 1:

You can download and install the "stress" utility... It allows you generate CPU, Memory, Disk and IO load from the command line.

Homepage: http://people.seas.harvard.edu/~apw/stress/

FAQ: http://people.seas.harvard.edu/~apw/stress/FAQ

Solution 2:

I prefere floating point ops:

for i in `seq 64`; do perl -e '$z=time()+(10*60); while (time()<$z) { $j++; $sqrt = sqrt($j) for (1..9999); }' & done

Be aware of your CPU number :-)