Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried cat /proc/cpuinfo but there is no "cpu cores" it works on LINUX though cat /proc/cpuinfo | grep "cpu cores"

Help me get a command for "cpu cores" in LINUX IA64

share|improve this question
If it's not in cpuinfo then you're probably not getting it. – Ignacio Vazquez-Abrams Oct 28 '11 at 5:02
hmm.. so how can i get cpu cores? – Abhishek Simon Oct 28 '11 at 5:27
Which Linux-Kernel do you use? It works pretty well for me on SLES with kernel – ddeimeke Oct 28 '11 at 8:19
@ddeimeke: 2.6.18-128.el5 ia64 – Abhishek Simon Oct 28 '11 at 8:59
How about ls /sys/devices/system/cpu/ or ls /sys/class/cpuid/ or ls /proc/acpi/processor/ or anything else you can find with find /sys /proc -iname cpu*? Is the number of cores all that you want? – rozcietrzewiacz Oct 28 '11 at 12:26

lscpu displays this information. Part of the source code of lscpu is here.

Looks like what lscpu does is look in /sys/devices/system/cpu and counts the number of cpu? directories. So if you don't want to rely on an external command to determine number of cpu's you could always do that yourself in a script or application.

I got too lazy and quit reading before I figured out how to determine number of cores, sockets, cores per socket, threads per core and all that good stuff but if you read the code at that link you can figure all that out.

share|improve this answer

intel has some sample code on their website (the tarball is at the top of the page). Download, and compile it, and it should enumerate your cpus. I don't have any itanium systems, so I couldn't test it, but I've used this code when I had questions about systems.

share|improve this answer
Thanks for your answer, also I don't need any 3rd party utils, need something that's inbuilt – Abhishek Simon Oct 29 '11 at 6:19

Do you have dmidecode installed? This issue just came up for me, and I needed nearly the same information you're asking for, and one of my coworkers suggested dmidecode.

# dmidecode -t processor | grep "Core Count"
Core Count: 4
Core Count: 4

That would indicate that there are 2 processors, with 4 cores each.

The full information available for a processor looks like:

Handle 0x0005, DMI type 4, 40 bytes
Processor Information
Socket Designation: LGA771/CPU2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 7A 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 23, Stepping 10
    FPU (Floating-point unit on-chip)
    VME (Virtual mode extension)
    DE (Debugging extension)
    PSE (Page size extension)
    TSC (Time stamp counter)
    MSR (Model specific registers)
    PAE (Physical address extension)
    MCE (Machine check exception)
    CX8 (CMPXCHG8 instruction supported)
    APIC (On-chip APIC hardware supported)
    SEP (Fast system call)
    MTRR (Memory type range registers)
    PGE (Page global enable)
    MCA (Machine check architecture)
    CMOV (Conditional move instruction supported)
    PAT (Page attribute table)
    PSE-36 (36-bit page size extension)
    CLFSH (CLFLUSH instruction supported)
    DS (Debug store)
    ACPI (ACPI supported)
    MMX (MMX technology supported)
    FXSR (Fast floating-point save and restore)
    SSE (Streaming SIMD extensions)
    SSE2 (Streaming SIMD extensions 2)
    SS (Self-snoop)
    HTT (Hyper-threading technology)
    TM (Thermal monitor supported)
    PBE (Pending break enabled)
Version: Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
Voltage: 1.4 V
External Clock: 1333 MHz
Max Speed: 5000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Slot 1
L1 Cache Handle: 0x0008
L2 Cache Handle: 0x0009
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 4
Core Enabled: 4
Thread Count: 4
Characteristics: None

So there's a ton of information you can get out of dmidecode.

share|improve this answer
Thanks for your answer, also I don't need any 3rd party utils, need something that's inbuilt – Abhishek Simon Nov 11 '11 at 4:26

If you have the POSIX-compliant /proc structure, you can do this:

$ num_cores=$(grep -c '^processor' /proc/cpuinfo)
share|improve this answer
Could you point me where in POSIX /proc/cpuinfo is specified? I've just looked in the SUSV4 and didn't find it. – AProgrammer Dec 11 '11 at 12:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.