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?

11 Answers 11

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

  • 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 Dec 26 '14 at 21:20
  • 1
    Try: uname -m. That'll only show the architecture. – Alexej Magura Nov 18 '16 at 14:29

It's simple! Use the arch command.

@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
  • 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
  • 1
    @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
  • 1
    @penguin359, no but it's often useful to find out if your OS is running 64-bit and if not if the hardware is capable, imo – xenoterracide May 3 '11 at 20:09

(EDIT: this answer is WRONG. Thanks to @Lizardx's comment)

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.

  • 3
    so clever and also reminds us what chip architecture is all about – code_monk Feb 19 '15 at 22:44
  • 2
    While elegant, this is unfortunately not correct: uname -m == i686 BUT if ((1<<32)); then echo 64bits;fi == 64bits This is a PAE kernel, 32 bit, not a 64 bit kernel. The cpu is 64 bit capable however, amd64. Since the question was how to determine kernel arch, this solution would yield incorrect results. – Lizardx Nov 18 '16 at 0:40
  • 1
    note (( is a Bashism and not defined by POSIX mywiki.wooledge.org/Bashism#Conditionals – Steven Penny Nov 26 '16 at 2:25
  • I have tried this on some 32 bit architectures and this thinks it is 64 bit. – dannyw Feb 18 '17 at 2:16
  • This can work ((1<<32)-1) – Ivijan Stefan Stipić Jan 17 at 10:53

For Debian:

On my PC

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

My Raspberry Pi 2

    ~ > dpkg --print-architecture
  • this works best when determining package architecture to use with checkinstall, thx! – Aquarius Power Feb 11 '16 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
  • 2
    This answer is misleading. If you enable multiarch support and install 64 bit kernel over 32 bit installation getconf LONG_BIT will print 32 though you are running 64 bit kernel. – kenn Jul 23 at 7:42

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
  • 1
    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

use syscap from Formake project

syscap allows to probe many system properties and test dependencies. It is a portable shell script.

Get CPU architecture:

syscap info -arch

Get kernel name and version:

syscap info -kernel -kernver

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;

Here's another method using uname.

From man uname:

... -i, --hardware-platform print the hardware platform or "unknown" ...

# uname -i x86_64 #

If you're looking for a simple one-liner, this is the most reliable solution that I've found that returns 64 or 32. It doesn't care if you're running ARM or not, and it should work on any system using bash or sh.

Beware, this will assume the system is either 32-bit or 64-bit. See my explanation below if you need to detect 8- 16- or some-other-bit architecture.

[ $((0xffffffff)) -eq -1 ] && echo 32 || echo 64

What's happing here?
The logic is very simple and it all boils down to how computers store signed integers. A 32-bit architecture only has 32 bits that it can use for storing signed integers while a 64-bit architecture has 64 bits! In other words the set of integers that can be stored is finite. Half of this set represents negative numbers and half represents positive numbers. The signed integer equalling -1 is represented as the largest number that can be stored in a given number of bits for that architecture. On a 32-bit system, -1 can be represented by the hex value 0xFFFFFFFF (which is 32 binary bits, all equalling 1). On a 64-bit system, 0xFFFFFFFF translates to 4,294,967,295, base 10 while 0xFFFFFFFFFFFFFFFF is the representation for -1). You can see how this would easily scale for systems that are 8- or 16-bit as well which would equal -1 at 0xFF and 0xFFFF, respectively.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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