49

I am on Ubuntu and I did this command:

$ uname -a
Linux slabrams-desktop 2.6.32-29-generic #58-Ubuntu SMP Fri Feb 11 19:00:09 UTC 2011 i686 GNU/Linux

Does it mean I am on 32bit or 64 bit processor?

The reason I am trying to figure this out is that I was getting errors which looked like this:

cannot execute binary file

and from Googling, I thought it was a processor issue. Any ideas?

1
  • Check out this link. A detailed description of your problem is given. Jan 18, 2017 at 11:05

5 Answers 5

94

You can use lscpu.

someuser@somelaptop:~$ lscpu
Architecture:          i686           # <-- your kernel is 32 bit
CPU op-mode(s):        32-bit, 64-bit # <-- your cpu can handle 32 or 64 bit instructions
CPU(s):                4
Thread(s) per core:    2
Core(s) per socket:    2
CPU socket(s):         1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 37
Stepping:              5
CPU MHz:               1199.000
Virtualisation:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K

Further explanation of the Architecture field:

X86, i686, or i386      means you are running a 32 bit kernel.
X86_64 , amd64 , or X64 means you are running a 64 bit kernel.
1
  • 1
    @slm: the architecture field refers to the kernel not the processor. I edited my answer to make it more clear. Jun 3, 2013 at 10:20
36

It means that you're running a 32-bit kernel, which means that you can only run 32-bit apps without the use of an emulator or virtualization.

If you want to see if your processor is 64-bit then look for lm in the flags listed in /proc/cpuinfo.

4
  • 29
    Also lscpu can be used, and is more friendly.
    – enzotib
    Apr 26, 2011 at 19:31
  • @Ignacio So I have a 32-bit processor which will need to run something which is made for 64-bit. Is that at all possible?
    – Genadinik
    Apr 26, 2011 at 19:31
  • 4
    I'm not Ignacio, but generally it's not. You could install a VM using a product that lets you emulate an 64-bit system o a 32-bit platform, though.
    – Eduardo I.
    Apr 27, 2011 at 5:58
  • Much lighter weight than a VM is either a chroot or an lxc container twinned with QEMU. It all depends on what you need really.
    – Ken Sharp
    Dec 19, 2017 at 0:10
7

You can also check the architecture of the binary you're trying to run by using file: file filetocheck. It will mention either 32-bit or 64-bit.

1
  • This should be the very first thing that is checked. 👍
    – Ken Sharp
    Dec 19, 2017 at 0:13
3

uname -p give the architecture of the processor. If it gives x86_64, it means cpu is 64 bit.

4
  • 1
    This is not always right, tho.
    – Braiam
    Feb 21, 2014 at 3:12
  • 2
    @Braiam: Would be great if you could explain why.
    – jobin
    Feb 21, 2014 at 3:57
  • 5
    @Jobin: uname prints information regarding the running kernel, not the CPU. For example you can run a 32-bit kernel on a 64-bit CPU. Jun 18, 2014 at 21:38
  • That is definitely incorrect.
    – Ken Sharp
    Dec 19, 2017 at 0:09
3

Basic idea:

x86_64 is 64 bit capable cpu and i386 is 32 bit.

With lscpu

Long answer: lscpu

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             AuthenticAMD
CPU family:            17
Model:                 3
Stepping:              1
CPU MHz:               550.000
BogoMIPS:              4397.92
Virtualization:        AMD-V
L1d cache:             64K
L1i cache:             64K
L2 cache:              512K
NUMA node0 CPU(s):     0,1

Short answer lscpu | awk '/CPU op-mode/ {print}

Output : CPU op-mode(s): 32-bit, 64-bit

With lshw

Long answer: run sudo lshw

Slightly shorter answer: sudo lshw -c cpu

Output:

 *-cpu                   
       description: CPU
       product: AMD Turion(tm) X2 Dual-Core Mobile RM-75
       vendor: Advanced Micro Devices [AMD]
       physical id: 4
       bus info: cpu@0
       version: Turion X2 Mobile RM-75
       slot: Socket M2/S1G1
       size: 550MHz
       capacity: 4GHz
       width: 64 bits
       clock: 200MHz
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp x86-64 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch osvw skinit hw_pstate lbrv svm_lock nrip_save vmmcall cpufr

Even shorter answer: sudo lshw -c cpu | grep width

Output: width: 64 bits

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .