the "proper" way to identify the bitness of your kernel and CPU

Sharpe, Sam J sam.sharpe+lists.redhat at gmail.com
Fri Apr 3 19:07:33 UTC 2009


2009/4/3 Robert P. J. Day <rpjday at crashcourse.ca>:
>
>  what is the fedora-approved way to identify the wordsize of both
> your running kernel and your CPU?  for the kernel, i'm used to running
>
>  $ uname -r
>
> and just looking at the suffix, which in my case would be either
> "i686" or "x86_64".  is there a simpler way?

# man arch
   NAME
       arch - print machine hardware name (same as uname -m)

# arch
x86_64

# uname -m
x86_64

>  and, secondly, regardless of the bitness of the kernel, what about
> identifying the wordsize of the actual CPU (since you can obviously
> have a 32-bit kernel running on an x86_64 CPU).
>
>  my standard tricks are one of:
>
>  $ grep lm /proc/cpuinfo    (where "lm" stands for long mode)
>  $ getconf LONG_BIT         (should print 32 or 64)

I like to get it in the same format as the output of arch:

[[ $(grep lm /proc/cpuinfo) ]] && echo x86_64 || echo i686

-- 
Sam




More information about the fedora-list mailing list