Home » Questions » Computers [ Ask a new question ]

How do I know if my linux kernel is running in 32bit or 64bit?

How do I know if my linux kernel is running in 32bit or 64bit?

When I do a cat in /proc/cpuinfo it shows a line with clflushsize : 64

Asked by: Guest | Views: 347
Total answers/comments: 3
bert [Entry]

"uname -a

will tell you the kernel - the end bit tells you the architecture.

Two examples:

My mac:

Darwin Mac.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386

My Dreamhost hosting:

Linux ecco 2.6.24.5-serf-xeon-c6.1-grsec #1 SMP Tue Oct 7 06:18:04 PDT 2008 x86_64 GNU/Linux

i386 = 32 bit

x86_64 = 64 bit"
bert [Entry]

"I think the most precise way is

getconf LONG_BIT

here it exactly shows 64

found on this tip

getconf is from package libc-bin (on ubuntu)"
bert [Entry]

"CLFLUSHSIZE doesn't tell you anything about the processor's operating mode. According to this answer, it refers to the smallest flushable unit of cache. In your case, cache lines are read/written in units of 64 bytes.

uname output varies too much to be useful, as a glance at Wikipedia's table of examples shows. The most reliable method is getconf LONG_BIT as show in Aquarius Power's answer. This works regardless of processor architecture, so is just at home on ARM, Power, or MIPS as on x86."
"CLFLUSHSIZE doesn't tell you anything about the processor's operating mode. According to this answer, it refers to the smallest flushable unit of cache. In your case, cache lines are read/written in units of 64 bytes.

uname output varies too much to be useful, as a glance at Wikipedia's table of examples shows. The most reliable method is getconf LONG_BIT as show in Aquarius Power's answer. This works regardless of processor architecture, so is just at home on ARM, Power, or MIPS as on x86."