Linux Processes Cheat Sheet/Show or change affinity for PID

Inspect or update CPU affinity for an existing process.

Section: Priority, Scheduling, and CPU Affinity

Show or change affinity for PID

bash
bash
taskset -cp 0-3 1234
Explanation

Inspect or update CPU affinity for an existing process.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Priority, Scheduling, and CPU Affinity
Run command on selected CPUs
Pin a command to specific CPU cores.
OpenIn sheetbashsame section
Start command with lower priority
Run a command with a niceness offset.
OpenIn sheetbashsame section
Change process priority
Adjust niceness for an existing process.
OpenIn sheetbashsame section
Show real-time scheduler
Inspect real-time scheduling policy and priority.
OpenIn sheetbashsame section
Set SCHED_FIFO policy
Assign a real-time FIFO scheduler to a process.
OpenIn sheetbashsame section
Run with IO priority
Run a command with lower I/O priority.
OpenIn sheetbashsame section