tags:

views:

4661

answers:

4

When I type uname -a, it gives the following output.

Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux

How can I know from this that the given OS is 32 bit or 64 bit?

+7  A: 

If you were running a 64 bit platform you would see x86_64 or something very similar in the output from uname -a

To get your specific machine hardware name run

uname -m

You can also call

getconf LONG_BIT

which returns either 32 or 64

Thomas Watnedal
That `getconf LONG_BIT` is especially convenient, thanks!
chronos
+8  A: 

Did you try uname -m ?

It seems like the uname -m actually gives

  • x86_64 when it is an kernel 64 bits
  • i686 for 32 bits kernel


Otherwise, not for the Linux kernel, but for the CPU, you type:

cat /proc/cpuinfo

or:

grep flags /proc/cpuinfo

Under "flags" parameter, you will see various values. Among them, one is named "tm(transparent mode)" or "rm(real mode)" or "lm(long mode)"

  1. rm means: 16 bit processor
  2. tm means: 32 bit processor
  3. lm means: 64 bit processor

Note: you can have a 64-bit CPU with a 32-bit kernel installed"

VonC
grep flags /proc/cpuinfo only tells you wether the CPU is 64bit. As I understand the question it was about the OS. uname -m only tells me "i686".
Kim
I run a 32bit kernel.
Kim
@Kim: true. I have update my answer to adequately reflect the difference between the kernel and the CPU
VonC
I have a 32 bit kernel on 64 bit hardware and get "x86_64" from 'uname -m' (on Debian). The man page for uname says that -m shows the machine hardware name, so that seems correct.
Tony Meyer
+2  A: 

That system is 32bit. iX86 in uname means it is a 32bit arch, if it was 64 bit it would return

Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 x86_64 i686 x86_64 x86_64 GNU/Linux
Louis Gerbarg
A: 

If you have a 64 bits OS, instead of i686, you have x86_64 or ia64 in the output of uname -a In you do not have any of these 2 strings, you have a 32 bits OS (note that this does not mean that your CPU is not 64 bits)

Denis R.