nproc: print the number of processing units available
nproc [--all]
Options you will use
--all- Every installed CPU, not only the ones this process may use.
Examples
$ nprochow many CPUs this process may run on - compare the load average with it
$ cat /proc/loadavg; nprocload per CPU: a load of 8 on 2 CPUs is a queue, on 16 it is idle
Gotchas
- nproc follows the CPU affinity (taskset, cpuset), not a cgroup CPU quota: a container limited with --cpus=1 still shows every host CPU, so a script that starts
nprocworkers starts too many.
Taught in
Try nproc in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.