Re: how to identify 32 vs 64 bit CPU?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2007-08-09 at 11:26 -0700, Antonio Olivares wrote:
> > ----- Original Message ----
> > From: Rick Stevens <rstevens@xxxxxxxxxxxx>
> > To: For users of Fedora <fedora-list@xxxxxxxxxx>
> > Sent: Thursday, August 9, 2007 12:24:25 PM
> > Subject: Re: how to identify 32 vs 64 bit CPU?
> > 
> > On Thu, 2007-08-09 at 17:50 +0100, Chris Jones wrote:
> > > > How about uname?  `uname -a` gives all of it.  See `man uname` for subsets
> > > > and the ordering of the "-a" output.  If you need more than just x86, I
> > > > think any solution will be a bit involved.
> > > 
> > > AFAIK, uname only tells you what you are running, not what you *could* 
> > > run. I.e. you couldn't tell the diffrence between a 32 bit os on a 64 
> > > bit capable machine or a 32 bit only machine.
> > 
> > If you get a result from 
> > 
> >     cat /proc/cpuinfo | grep " lm "
> > 
> > you're on a 64-bit processor regardless whether it's a 32- or 64-bit OS.
> > If you want to know if the OS is 64-bit, then a result from 
> > 
> >     uname -a | grep 64
> > 
> > would indicate a 64-bit OS.
> > 
> 
> Stupid shell script:
> 
>     #!/bin/bash
>     echo -n "Running "
>     RES=`uname -a | grep 64`
>     if [ $? -eq 0 ]; then
>         echo -n "64-bit "
>     else
>         echo -n "32-bit "
>     fi
>     echo -n "operating system on a "
>     RES=`cat /proc/cpuinfo | grep " lm "`
>     if [ $? -eq 0 ]; then
>         echo -n "64-bit "
>     else
>         echo -n "32-bit "
>     fi
>     echo "machine"
> 
> Have fun, gang.

> 
> Rick,
> 
>    This is not a "Stupid Shell Script" it is an AWESOME shell script that does the job it is intended for.  Thank you for providing excellent advice through the years.  Along with several others on this list whose names I think not need mention make this list one of the best.  I always enjoy reading these kinds of posts.  

[blush!] Thank you, Antonio.  I refer to it as an SSS because there are
others on the list that could write a much more elegant (and probably
more comprehensve) script than I can.  Mine do have the, uhm, charm of
being fairly easy for newbies to read and modify to suit their needs.

----------------------------------------------------------------------
- Rick Stevens, Principal Engineer             rstevens@xxxxxxxxxxxx -
- CDN Systems, Internap, Inc.                http://www.internap.com -
-                                                                    -
-      Always remember you're unique, just like everyone else.       -
----------------------------------------------------------------------


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux