Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell a 32 bit machine from 64?

Status
Not open for further replies.

stackdump

Technical User
Sep 21, 2004
278
GB
I am writing some csh files and need to find a way of telling whether a machine is 32-bit or 64-bit so that I can branch the code.

I guess its a parameter from uname but I cant see any likely candidates. Any help appreciated.

 
Hi,

What OS are you wrking on ?

On a Linux redhat box
Code:
getconf WORD_BIT
32
On AIX box
Code:
bootinfo -K
32
 



PS: You should re-consider the use of csh, instead use ksh, bash or even sh (whichever is available to you). [3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
You can as well see the unix to which kernal it is linked to!

ls -al /unix!

If it was linked to /usr/lib/boot/unix_64 then the kernal is 64 but if it was linked to /usr/lib/boot/unix_mp then it is 32 (That's an aix example but i think it is somehow common for the reset)

bootinfo -K will definitly do the job!

Regards,
Khalid
 
Thanks.

I ended up using;
uname -m
which is x86_64 for 64 bit or i686, i386 for 32 bit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top