OS Manuals

/usr/bin/taskset

Misc binaries for util-linux

From util-linux-misc 2.42.4-r2 (os), captured 2026-11-05 by running taskset --help (exit 0). permalink

Usage: taskset [options] [mask | cpu-list] [pid|cmd [args...]]


Show or change the CPU affinity of a process.

Options:
 -a, --all-tasks         operate on all the tasks (threads) for a given pid
 -p, --pid               operate on existing given pid
 -c, --cpu-list          display and specify cpus in list format
 -h, --help              display this help
 -V, --version           display version

The default behavior is to run a new command:
    taskset 03 sshd -b 1024
You can retrieve the mask of an existing task:
    taskset -p 700
Or set it:
    taskset -p 03 700
List format uses a comma-separated list instead of a mask:
    taskset -pc 0,3,7-11 700
Ranges in list format can take a stride argument:
    e.g. 0-31:2 is equivalent to mask 0x55555555

For more details see taskset(1).
Options (5)
OptionDescriptionSource
-a, --all-tasksSet or retrieve the CPU affinity of all the tasks (threads) for a given PID.help + man
-p, --pidOperate on an existing PID and do not launch a new task.help + man
-c, --cpu-listInterpret mask as numerical list of processors instead of a bitmask.help + man
-h, --helpDisplay help text and exit.help + man
-V, --versionDisplay version and exit.help + man
Examples (1) from the manual page, untested

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.