Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
1  
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
3  
getconf WORD_BIT returns 32 on my 64-bit Ubuntu –  minaev May 4 '11 at 8:53

5 Answers 5

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
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
1  
@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 20 hours ago

@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 arch command.

share|improve this answer
2  
Odd... on my 2013 MacBook Pro, arch returns i386, but uname -a shows x86_64. –  turboladen Aug 19 '13 at 20:38

In Bash, using integer overflow:

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

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

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

Your Answer

 
discard

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.