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

uname -m gives i686 and uname -m gives i686 i386 output in Red Hat Enterprise Linux Server release 5.4 (Tikanga) machine. I need to install Oracle Database 10g Release 2 on that machine. So, how can I decide whether kernel architecture is 32bit or 64bit?

share|improve this question
Is that a typo on the first sentence: uname -m and uname -m? – Tshepang May 2 '11 at 17:34
See also Linux command to return number of bits (32 or 64)?. If uname -m shows i?86, you have a 32-bit system. – Gilles May 2 '11 at 21:29
See also Get Distribution Name and Version Number – Mikel May 2 '11 at 23:07
The question Gilles links to gives an interesting solution: getconf WORD_BIT. – Mikel May 2 '11 at 23:11
getconf WORD_BIT returns 32 on my 64-bit Ubuntu – minaev May 4 '11 at 8:53

i386 and i686 are both 32-bit.
x86_64 is 64-bit

example for 64 bit:

behrooz@behrooz:~$ uname -a  
Linux behrooz 2.6.32-5-amd64 #1 SMP Mon Mar 7 21:35:22 UTC 2011 **x86_64** GNU/Linux

See is my linux ARM 32 or 64 bit? for ARM

share|improve this answer
What about armv7l? In any case, a command with a simple boolean response would be delicious. – user7543 Oct 26 '13 at 23:40
@user7543 It's ARM 32-bit, because we don't have 64-bit ARM yet.When we do, It's gonna be something different. – Behrooz Oct 27 '13 at 7:38
I feel like I should make my answer community wiki but don't know how. – Behrooz Dec 26 '14 at 21:20

@behrooz is correct. Unfortunately uname requires you to know architectures. Actually, I was looking for a list of architectures and I found this article that answers your question. In regards to uname -m:

x86_64 GNU/Linux indicates that you've a 64bit Linux kernel running. If you use see i386/i486/i586/i686 it is a 32 bit kernel.

To determine if the hardware is capable of running a 64-bit kernel

grep flags /proc/cpuinfo

Look for the following in the output (all flags retrieved from this stackoverflow answer for the same question )

  • lm flag means Long mode cpu - 64 bit CPU
  • tm flag means Protected mode - 32-bit CPU
  • rm flag means Real Mode - 16 bit CPU
share|improve this answer
Does the lm flag simply mean the CPU supports 64-bit or does it mean that it's running in 64-bit. I recommend relying on the arch knowing that it will be x86_64 for 64-bit or i?86 for 32-bit. – penguin359 May 2 '11 at 21:45
@penguin359 it means that the cpu supports 64-bit. – xenoterracide May 2 '11 at 22:57
@xeno so then is can't be used to determine the kernel architecture. – penguin359 May 2 '11 at 23:58
@penguin359 no, was that unclear in the answer? – xenoterracide May 3 '11 at 8:55
@xeno When I first read your answer, I took it as implying an alternative to looking at the kernel architecture. On a re-read, I do notice you were specifying the CPU architecture, but I wanted to clarify that that does not help with the user's question which is specifically whether the kernel is 64-bit. – penguin359 May 3 '11 at 11:01

It's simple! Use the arch command.

share|improve this answer
Odd... on my 2013 MacBook Pro, arch returns i386, but uname -a shows x86_64. – turboladen Aug 19 '13 at 20:38
@turboladen "why do uname and arch differ in output?" = superuser.com/questions/835514/… – user10607 May 27 at 14:44
Good to know--thanks @user10607 – turboladen May 27 at 17:26

In Bash, using integer overflow:

if ((1<<32)); then
  echo 64bits
  echo 32bits

It's much more efficient than invoking another process or opening files.

share|improve this answer
so clever and also reminds us what chip architecture is all about – code_monk Feb 19 '15 at 22:44

For Debian:

On my PC

    ~ > dpkg --print-architecture
    ~ > dpkg --print-foreign-architectures

My Raspberry Pi 2

    ~ > dpkg --print-architecture
share|improve this answer
this works best when determining package architecture to use with checkinstall, thx! – Aquarius Power Feb 11 at 1:59

The simplest way is to run:

getconf LONG_BIT

which will output 64 or 32 depending on whether it is 32 or 64 bits.


dannyw@dannyw-redhat:~$ getconf LONG_BIT
share|improve this answer

Another way is to check the architecture some system file was compiled for, like

$ file /usr/bin/ld
/usr/bin/ld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
share|improve this answer
That's the system architecture, which isn't always the kernel architecture. See this answer at SU for more variations. – Gilles May 4 '11 at 9:47
Theoretically, they may differ, but is there a chance they would mismatch on any real-life installation? – minaev May 5 '11 at 11:30
Some distributions ship an amd64 kernel on the x86 version. I don't know how many people use them, I checked Debian popcon but it doesn't correlate between the various stats. I think the main use case is having a 32-bit main OS and running a 64-bit OS in a chroot or in a VM. – Gilles May 5 '11 at 20:00
@Gilles You're gonna love what you'll read about the new x32 architecture, If I'm not too late, off course. wiki.debian.org/X32Port – Behrooz Oct 27 '13 at 7:41

Or you can use the way of what the uname command internally does if you want to implement some stuff on your own:

#include <sys/utsname.h>
#include <stdio.h>

int main() {
    struct utsname name;
    return 0;
share|improve this answer

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.