๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

๐Ÿ–ฅ๏ธ System Information March 8, 2026 78

Linux Command: nproc

Print the number of processing units available

Terminal โ€” System Information
Command
$ nproc
Output
Shows the number of available processing units.

nproc prints the number of available processing units (CPU cores/threads). It is the simplest way to determine how many parallel tasks the system can handle. nproc is commonly used with make -j for parallel compilation and with xargs -P for parallel command execution. It respects cgroup limits in containers, making it more accurate than parsing /proc/cpuinfo. nproc outputs a single number, making it perfect for command substitution in scripts.

Syntax

nproc [OPTION]...

Common Examples

  • nproc โ€” Shows the number of available processing units.
  • make -j$(nproc) โ€” Compiles using all available CPU cores.
  • find . -name '*.png' | xargs -P $(nproc) -I {} convert {} -resize 50% {} โ€” Processes images in parallel using all cores.
  • make -j$(($(nproc) - 1)) โ€” Compiles using all cores except one, keeping system responsive.

Pro Tips

    Master this and 230+ other Linux commands with our comprehensive eBooks and cheat sheets.

    Share this tip