The system of my VPS is centos 5. I want to know if it is 32bit or 64bit.

> uname -a
Thu May 13 13:49:53 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

looks like 64 bit.

But

> getconf WORD_BIT
32

Looks like 32 bit.

Which is correct?


UPDATE

I believe the linux of my VPS is 32 bit. Because I downloaded a 64bit mongodb, found it can't start. And when I downloaded a 32bit instead, it works well.

link|improve this question

feedback

3 Answers

up vote 2 down vote accepted

Well, it depends. It's possible getconf doesn't return the correct value, and it's possible you have a 32-bit kernel on 64-bit hardware. I'd say, however, that the output of uname is what you should go by, as it states that you're running a 64-bit kernel.

link|improve this answer
thank you, I believe it's 64bit now :) – Freewind Jul 10 '10 at 9:05
I don't think it's possible that it's 32-bit kernel on 64-bit hardware if uname -a gives those results... – Andy Jul 10 '10 at 9:32
feedback

uname -a shows whether the OS is 32/64 bit.

link|improve this answer
@Andy, thanks for your answer – Freewind Jul 10 '10 at 9:06
welcome! fyi, getconf WORD_BIT returns 32 on my 64 bit Ubuntu. Also sizeof(int) is 32 bits... maybe that's what the getconf command is reporting. – Andy Jul 10 '10 at 9:30
I'd think sizeof(void*) would be the indicator – David Zaslavsky Jul 10 '10 at 10:08
sizeof(void*) is going to be 8 bytes for 64 bit architectures no? I don't know what getconf WORD_BIT does, and was guessing it may be related to the size of an int because that actually is 32 bits! Edit: (on my current 64 bit OS...) – Andy Jul 10 '10 at 10:12
Indeed, the size of an int is not the arch size. This nice Wikipedia table shows how int sizes can be anywhere between ¼ word to 4 words on the 80486 family. – alexandru Jul 10 '10 at 15:39
show 1 more comment
feedback

The glibc's WORD_BIT seems to be broken, because (in xopen_lim.h) it looks at __INT_MAX__ instead of __WORDSIZE or sizeof(__SWORD_TYPE).

To report the syscall personality of the current process, those commands are equivalent:

uname -m
arch

To change it, assuming your kernel supports it:

linux32
linux64

It is possible to have a 64bit kernel with a 32bit userland. To know what kind of kernel you have:

sudo file /proc/kcore

Your CPU:

cat /proc/cpuinfo
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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