How to determine number of CPUs on Linux using command line

Originally published at: https://www.cyberciti.biz/faq/how-to-determine-number-of-cpus-on-linux-using-command-line/

I am a new Linux system admin. How do I obtain the number of CPUs and cores in the Linux system from the command line? How do I determine the number of CPUs on Linux?