Without Third-party tools, the/proc/cpuinfo in the proc file system provides rich CPU information.
The output is similar to the following:
processor:0
Vendor_id:authenticamd
CPU Family:16
Model:4
Model Name:quad-core AMD Opteron (tm) Processor 8382
Stepping:2
microcode:0x1000086
CPU mhz:2611.977
Cache size:512 KB
Physical id:0
Siblings:4
Core id:0
CPU Cores:4
Apicid:4
Initial apicid:0
Fpu:yes
Fpu_exception:yes
CPUID Level:5
Wp:yes
FLAGS:FPU VME de PSE TSC MSR PAE MCE cx8 APIC Sep MTRR PGE MCA cmov Pat PSE36 Clflush MMX FXSR SSE SSE2 HT SYS Call NX Mmxext fxsr_opt PDPE1GB rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid PNI Monitor CX popcnt lahf_lm cmp_legacy SVM extapic cr8_legacy ABM sse4a misalignsse 3dnowprefetch osvw IBS skinit WDT hw_pstate NPT LBRV Svm_lock Nrip_save
bogomips:5223.95
TLB size:1024 4K Pages
Clflush size:64
Cache_alignment:64
Address sizes:48 bits physical, bits virtual
Power Management:ts TTP TM STC 100mhzsteps Hwpstate
Number of models and logical CPUs
$ cat/proc/cpuinfo | grep ' model name ' | Cut-f2-d: | Uniq-c
Quad-core AMD Opteron (tm) Processor 8382
You can see that there are 32 logical CPUs, followed by the model
Number of physical CPUs
$ cat/proc/cpuinfo | grep ' Physical ID ' | Uniq-d
Physical id:0
Physical Id:1
Physical Id:2
Physical Id:3
Physical Id:4
Physical Id:5
Physical Id:6
Physical Id:7
Or
$ cat/proc/cpuinfo | grep ' Physical ID ' | uniq-d | Cut-f1-d: | Uniq-c
8 Physical ID
You can see that there are 8 physical CPUs
Number of cores per CPU
$ cat/proc/cpuinfo | grep ' CPU cores ' | Uniq
CPU Cores:4
Or
$ cat/proc/cpuinfo | grep ' Core ID ' | Sort | Uniq
Core id:0
Core Id:1
Core Id:2
Core Id:3
8*4 is just 32 logical CPUs, and if hyper-threading technology is not a simple multiplication, multiply the number of threads per core.
There is also a command lscpu that can overview the system's CPU profile:
$ lscpu
Architecture:x86_64
CPU Op-mode (s): 32-bit, 64-bit
Byte Order:little Endian
CPU (s): 32
On-line CPU (s) list:0-31
Thread (s) per core:1
Core (s) per Socket:4
Socket (s): 8
NUMA node (s): 4
Vendor ID:AUTHENTICAMD
CPU family:16
Model:4
Stepping:2
CPU mhz:2611.977
bogomips:5224.55
Virtualization:amd-v
L1D cache:64k
L1i cache:64k
L2 cache:512k
L3 cache:6144k
NUMA node0 CPU (s): 0-3
NUMA Node1 CPU (s): 4-7
NUMA Node2 CPU (s): 8-11
NUMA node3 CPU (s): 12-31