• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

chcpu: command not found

by Deepika

The chcpu command is a utility in Linux that is used to change the CPU affinity of a process. CPU affinity is a way to specify which CPU or CPUs a process should be allowed to run on. By setting the CPU affinity of a process, you can control how the process is scheduled on the CPU, which can be useful for optimizing performance or avoiding CPU contention.

To use the chcpu command, you will need to specify the process ID of the process that you want to change the CPU affinity of, and the CPU or CPUs that you want the process to be allowed to run on.

To set the CPU affinity of a process to a specific CPU, use the -p option followed by the process ID and the CPU number:

# chcpu -p 12345 0

This will set the CPU affinity of the process with ID 12345 to CPU 0.

If you encounter the below error while running the command chcpu:

chcpu: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install util-linux
Ubuntu apt-get install util-linux
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install util-linux
CentOS yum install util-linux
Fedora dnf install util-linux
OS X brew install util-linux
Raspbian apt-get install util-linux

deepika Command Examples

1.Disable CPUs via a list of CPU ID numbers:

chcpu -d 1,3

2.Enable a set of CPUs via a range of CPU ID numbers:

chcpu -e 1-10

Filed Under: Linux

Some more articles you might also be interested in …

  1. s2i: command not found
  2. gixy Command Examples
  3. How to uninstall speedtest-cli package from Ubuntu
  4. rsync Command Examples in Linux
  5. How to restore files under user’s home directory to default in Linux
  6. kubetail Command Examples
  7. locale-gen: command not found
  8. calendar: Display upcoming events from a calendar file
  9. How the BASH Shell load its configuration files in Linux
  10. ipcalc: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright