LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 02-02-2009, 03:44 AM   #1
kauuttt
Member
 
Registered: Dec 2008
Location: Kolkata, India
Distribution: Ubuntu
Posts: 123

Rep: Reputation: 25
Lightbulb 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..

Any suggestion? Its urgent guys

cheers-
kd
 
Old 02-02-2009, 04:01 AM   #2
dchmelik
Member
 
Registered: Nov 2008
Location: Washington state, USA
Distribution: BSD, GNU/Linux (Slackware, etc.,) openSolaris
Posts: 198

Rep: Reputation: 21
Try:

Code:
ls /usr/lib64
.

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.
 
Old 02-02-2009, 05:49 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,284

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
*
' uname -a ' ?

....

EDIT, sorry 'uname -m' already told : 'i686'

....

Last edited by knudfl; 02-02-2009 at 07:34 AM.
 
Old 02-02-2009, 06:36 AM   #4
kauuttt
Member
 
Registered: Dec 2008
Location: Kolkata, India
Distribution: Ubuntu
Posts: 123

Original Poster
Rep: Reputation: 25
I dont think 'uname -a' will help!!!
it can't provode me the info whether 32 or 64 bit. I chked uname -m.

Any suggestions? which I can use to get the info/
 
Old 02-02-2009, 06:43 AM   #5
kauuttt
Member
 
Registered: Dec 2008
Location: Kolkata, India
Distribution: Ubuntu
Posts: 123

Original Poster
Rep: Reputation: 25
dchmelik, infact /usr/lib64 is not there in my 64 bit system.
any standard command?
 
Old 02-02-2009, 09:34 AM   #6
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,142

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by kauuttt View Post
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.

Last edited by johnsfine; 02-02-2009 at 09:39 AM.
 
Old 02-02-2009, 05:17 PM   #7
dchmelik
Member
 
Registered: Nov 2008
Location: Washington state, USA
Distribution: BSD, GNU/Linux (Slackware, etc.,) openSolaris
Posts: 198

Rep: Reputation: 21
Quote:
Originally Posted by johnsfine View Post
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.
 
Old 02-02-2009, 05:49 PM   #8
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,142

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by dchmelik View Post
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.
 
Old 02-03-2009, 02:31 AM   #9
kauuttt
Member
 
Registered: Dec 2008
Location: Kolkata, India
Distribution: Ubuntu
Posts: 123

Original Poster
Rep: Reputation: 25
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
 
Old 02-03-2009, 08:59 AM   #10
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,142

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by kauuttt View Post
Infact i have 32 bit application installed on 64 bit procecure.
The info you put in the first post looks like a 32 bit kernel installed on a 32 bit processor.

Quote:
Now I am able to distinguish from them. /proc/cpuinfo contents proved helpfull.
What do you see in /proc/cpuinfo that makes you think your processor is 64 bit?
 
Old 02-05-2009, 03:44 AM   #11
kauuttt
Member
 
Registered: Dec 2008
Location: Kolkata, India
Distribution: Ubuntu
Posts: 123

Original Poster
Rep: Reputation: 25
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.
 
Old 04-22-2009, 08:33 AM   #12
SureshM
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
64 bit cpu-64 bit Ubuntu-are there 32 bit app issues? sofasurfer Ubuntu 7 04-09-2014 03:02 PM
how to check linux kernel is 32 bit or 64 bit surprise_frnd Linux - General 13 10-16-2012 10:55 AM
Compile 32-bit kernel on a 64-bit machine kushalkoolwal Debian 6 06-15-2009 06:48 PM
compiling 64 bit kernel in 32 bit linux MadnessASAP Linux - Hardware 6 05-04-2009 12:47 PM
32-bit or 64-bit linux kernel ??? gsundeep Linux - General 2 04-24-2003 09:43 PM


All times are GMT -5. The time now is 12:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration