taskset

Get or set a process' CPU affinity or start a new process with a defined CPU affinity. More information: <https://manned.org/taskset>.

Install

All systems
curl cmd.cat/taskset.sh
Debian Debian
apt-get install util-linux
Ubuntu
apt-get install util-linux
Alpine
apk add util-linux
Arch Arch Linux
pacman -S util-linux
image/svg+xml Kali Linux
apt-get install util-linux
CentOS
yum install util-linux
Fedora
dnf install util-linux
Windows (WSL2)
sudo apt-get update sudo apt-get install util-linux
OS X
brew install util-linux
Raspbian
apt-get install util-linux
Docker
docker run cmd.cat/taskset taskset powered by Commando

Get or set a process' CPU affinity or start a new process with a defined CPU affinity. More information: <https://manned.org/taskset>.

  • Get a running process' CPU affinity by PID:
    taskset --pid --cpu-list pid
  • Set a running process' CPU affinity by PID:
    taskset --pid --cpu-list cpu_id pid
  • Start a new process with affinity for a single CPU:
    taskset --cpu-list cpu_id command
  • Start a new process with affinity for multiple non-sequential CPUs:
    taskset --cpu-list cpu_id_1,cpu_id_2,cpu_id_3
  • Start a new process with affinity for CPUs 1 through 4:
    taskset --cpu-list cpu_id_1-cpu_id_4

© tl;dr; authors and contributors