CPU/Processor information in Linux

Finding Physical Processors:
$ grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l

Finding Virtual Processors
$ grep ^processor /proc/cpuinfo | wc -l

Finding CPU cores
$ grep 'cpu cores' /proc/cpuinfo

“2” indicates the two physical processors are dual-core, resulting in 4 virtual processors.
If “1” was returned, the two physical processors are single-core.

If the processors are single-core, and the number of virtual processors is greater than the number of physical processors, the CPUs are using hyper-threading.

Finding CPU Arch
$ grep flags /proc/cpuinfo | uniq | egrep -o -w "rm|tm|lm"

Under “Flags” section in /proc/cpuinfo, you will find any of the flags “tm” or
“rm” or “lm”

  • rm (Real Mode) means it is a 16 bit processor
  • tm (Transparent Mode) means it is a 32 bit processor
  • lm (Long Mode) means it is a 64 bit processor