System Grab Bag

View all TLDR pages from Linux (or from all pages)

taskset

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}}

License and Disclaimer

The content on this page is copyright © 2014—present the tldr-pages team and contributors.
This page is used with permission under Creative Commons Attribution 4.0 International License.

While we do attempt to make sure content is accurate, there isn't a warranty of any kind.