How to check whether kernel is 32 bit or 64 bit in linux?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to check whether kernel is 32 bit or 64 bit in linux?
Hi,
I want to check whether the kernel is 32 bit or 64 bit in linux?
I tried the following:-
root@kd-killer-1:~# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Xeon(TM) CPU 2.40GHz
stepping : 7
cpu MHz : 2393.298
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
bogomips : 4790.00
root@kd-killer-1:/# uname -m
i686
I am not getting the info from the above commands and also not able to use getconf command..It is throwing errors 'commands not found'. And doing a file <exe> is also not a good idea..
If /usr/lib64 is not there, the kernel is probably not 64-bit, unless you copied it from a 64-bit to 32-bit machine. There are other ways to check when making a kernel, but it has been a while since I did that on 32-bit.
I dont think 'uname -a' will help!!!
it can't provode me the info whether 32 or 64 bit. I chked uname -m.
uname -a would tell you and uname -m DID tell you.
Quote:
root@kd-killer-1:/# uname -m
i686
You have a 32 bit kernel. i686 is one of the indicators from uname (probably the most common) that you have a 32 bit kernel.
If you had a 64bit kernel that would say x86_64. There is much less variety in the reporting of 64 bit x86 kernels. They should all be "x86_64", while 32 bit x86 kernels might be i686 or various other things containing "86" and not containing "86_64".
If you didn't truncate the output of the flags line from cat /proc/cpuinfo, that also tells you that you have a 32-bit kernel. It could not tell you if you had a 64-bit kernel, because it only tells you whether your CPU is able to run a 64-bit kernel, which could be true even when running 32-bit. But your flags line says your CPU is not able to run a 64-bit kernel, so that indicates the running kernel must be 32-bit.
uname -a would tell you and uname -m DID tell you.
That is what I suspected, as well as perhaps '-i,' but what about a 32-bit OS, like Slackware, on a 64-bit system? In that example you can choose x86_64 processors, but will uname -i or -m or -p really show i386/etc. then? Now I mostly use Slamd64, so it -i, -m, -p show the same thing, but I noticed uname has some kernel info switches, so I assume what you told kauuttt is right.
what about a 32-bit OS, like Slackware, on a 64-bit system?
In that case, uname will show you that you have a 32-bit kernel. Nothing in the uname output will say x86_64.
cat /proc/cpuinfo would tell you if you have a 64-bit capable CPU.
Quote:
I assume what you told kauuttt is right.
I assume so too, because I've tried these commands on at least a dozen systems with varied hardware and varied version of Linux, plus I've read what others have posted in many previous threads discussing exactly this same question.
thnks a lot guys !!
Infact i have 32 bit application installed on 64 bit procecure. Now I am able to distinguish from them. /proc/cpuinfo contents proved helpfull. thanks guys for making me more knowledgeable
Yeah you are right !!
The logs which I provided is related to 32 bit application on 32 bit processor. I have a other system (64 bit procecure), where I checked.
To FIND whether OS (kernel) is 32 or 64 bit
============================================
Method 1:
$ uname -a
x86_64,ia64 indicates 64 bit OS ; rest all [i386/i486/i586/i686] are indicate 32 bit
Method 2:
$ file /usr/bin/initdb
ELF 32-bit LSB executable : means 32 bit
ELF 64-bit LSB executable : means 64 bit
To FIND processor is 32 or 64 bit
====================================
$ grep flags /proc/cpuinfo
If there is "lm" flag, then the processor is 64-bit, else 32
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.