NPROC(1) General Commands Manual Fully-rendered PDF

nprocget processor count

nproc [-a] [-i IGN]

Writes the number of available CPUs, followed by a newline, to the standard output stream. This can be modeled as (cpus - IGN, 1).

, --all
Writes the number of configured CPUs, which may be more than the available ones if non-default CPU affinity is configured. This corresponds to the _SC_NPROCESSORS_CONF sysconf(3) value.
, --ignore=IGN
Ignore (subtract) up to this many CPUs, if available (default ).

Without -a:

Overrides the CPU count. Must be ≥1; ignored if invalid.
Limits the CPU count to no more than the value. Must be ≥1; ignored if invalid.

cpuset(1), taskset(1), cpuset_getaffinity(2), pthread_getaffinity_np(3), sysconf(3)

Compatible with the GNU system. The short flags are an extension.

May 30, 2025 voreutils 5a9f9f29