Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Does this mean my kernel is running in 64 bits?

share|improve this question
up vote 15 down vote accepted
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 #1 SMP Tue Oct 7 06:18:04 PDT 2008 x86_64 GNU/Linux

i386 = 32 bit

x86_64 = 64 bit

share|improve this answer
This answer is wrong. The end bit tells you the architecture exposed to the process, not the kernel architecture. See this link. – David Schwartz Aug 19 '15 at 8:46

uname -m will give you the architecture you kernel is compiled for. If it prints i686 then your kernel is 32 bit, if x86_64 then it's 64 bit, assuming you have an Intel/AMD chip.

share|improve this answer
Could also be i386 on older 32-bit platforms (and I have even seen some packages compiled for i586 - not sure if that would ever be output by uname, though) – a_m0d Aug 26 '09 at 11:55
This answer is wrong. uname -m gives you the architecture the kernel chooses to expose to this particular process, not the kernel's native architecture. See this link. – David Schwartz Aug 19 '15 at 8:43
@David Schwartz: Your comment is too harsh for no good reason and the fact that you've posted no alternative is making it look even worse. Anyway note that by default uname -m does report the real architecture. If it's not, then most likely the admin really-really wants you to believe you're on that other architecture and your best bet is to accept that he knows what he's doing. If you are the admin and you're messing with setarch then you already know better anyway. – ndemou Dec 2 '15 at 20:11
I don't know what's harsh about the true factual statement that the answer is wrong. What do ou mean by "making it look even worse". Maybe there is no way. Maybe there is a good way. I don't happen to know, so I didn't answer this question. As for the end of your comments, I just don't agree. Scripts can, and do, use setarch and you might invoke such a script without having any idea that it causes uname -m to return something different. It's possible, maybe even likely, that these kinds of issues are why the OP is asking. – David Schwartz Dec 2 '15 at 23:23
@ndemou the admin may have set the system up in such a way that any application including init thinks it's 32-bit: the situation for this is 64-bit kernel with 32-bit userspace. Many compilation systems depend on uname -m to determine compiler flags, e.g. that of GDB, they must be supplied with fake personality. But some other userspace application can still want to know what type of kernel it has (e.g. for some low-level needs), regardless of personality. – Ruslan Jun 4 at 9:52

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)

share|improve this answer

If you want to see only the platform that you are running on, you can use

uname -i

The full list of supported options for uname is

$ uname --help
Usage: uname [OPTION]...
Print certain system information.  With no OPTION, same as -s.

  -a, --all                print all information, in the following order,
                             except omit -p and -i if unknown:
  -s, --kernel-name        print the kernel name
  -n, --nodename           print the network node hostname
  -r, --kernel-release     print the kernel release
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type or "unknown"
  -i, --hardware-platform  print the hardware platform or "unknown"
  -o, --operating-system   print the operating system
      --help     display this help and exit
      --version  output version information and exit
share|improve this answer
uname -i prints GenuineIntel, which isn't really what he's looking for. – spatz Aug 26 '09 at 11:58
and Unknown on a Mac. – Rich Bradshaw Aug 26 '09 at 12:07
prints i386 on my machine! – a_m0d Aug 27 '09 at 1:46

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.

share|improve this answer

These four bash commands will tell you almost everything you'd like to know:

grep -w 'lm' /proc/cpuinfo > /dev/null && echo "You have a 64bit CPU" || echo "You have a 32bit CPU"
echo "Your kernel reports it's running on a $(uname -m|sed -e 's/x86_64/64bit/' -e 's/i.86/32bit/') machine"
echo "Your /sbin/init process is $(file /sbin/init|sed -e 's/^.* \(32\|64\)-bit.*$/\1bit/')"
echo "Your C compiler is setup to produce $(getconf LONG_BIT)bit executables"

If the results seem contradictory please note the following facts:

  • You can run 32bit kernels on 64bit CPUs (but not the inverse)
  • You can run 32bit executables on 64bit kernels (but not the inverse)

and read this page and this answer

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .