switch off cpu cores in ubuntu/linux

For some benchmarks it can be important to have a system operating on just a specific number of CPU cores. To find out how many you have, just count them by:

Switching a core off is just as easy as

which would switch off core 7.
For simplification, i got a shell script for activating/deactivating the cores 2 to 7 on the console (file is called “multiCoreSwitch.sh”:

Which then can be called by:
Switch on:

Switch off:

For checking whether the cores are running or not, run “top” and enter 1, for toggling the cpu view.