Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the best way to determine whether my OS is 64-bit or 32-bit ?

Assume that, I directly on some os & I am going to install a software on it. But how to determine, whether OS is 32-bit or 64-bit,

OS may be anything, like

  • windows xp
  • vista
  • windows 7
  • os x leopard
  • os x snow leopard
  • Red hat linux

What I mean is - what is the best & common way to determine whether os is 64-bit or 32-bit? I mean, I am talking in general. I haven't installed os on someone's machine & if I tell you to determine its OS base - 64 or 32 ? then what would you do ?

Thanks in advance for sharing your knowledge. Sugar.

share|improve this question
    
But what about OSX ? –  Sagar R. Kothari Jun 11 '11 at 6:41
add comment

5 Answers 5

up vote 6 down vote accepted

In many Unix-like systems you can type in:

uname -a

For FreeBSD it looks like:

FreeBSD whiplash 8.0-STABLE FreeBSD 8.0-STABLE #1: 
Tue Mar  9 15:38:19 CET 2010     root@beast:/usr/obj/usr/src/sys/WHIPLASH  amd64

(amd64 means that this kernel is 64-bit)

For Linux:

Linux softy.vm 2.6.18-128.el5 #1 SMP 
Wed Jan 21 10:44:23 EST 2009 i686 athlon i386 GNU/Linux

(i386 means that this kernel is 32-bit)

For MacOSX:

Darwin iMac.local 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 PDT 2009;
root:xnu 1456.1.25~1/RELEASE_X86_64 x86_64

(x86_64 means that this kernel is 64-bit)

share|improve this answer
1  
Or just "uname -p" which returns results like i386, x86_64, amd64 :) –  Janne Pikkarainen Aug 10 '10 at 8:02
    
what's i386 ? uname -p works but I don't understand i386 –  Sagar R. Kothari Aug 10 '10 at 8:12
1  
Keep in mind that on OSX, even if you have a x86_64 CPU, (some of) the kernel might run in 32 bit. This is true for the early 2008 MacBook (4,1) for example. –  trolle3000 Aug 10 '10 at 8:17
    
@sugar, i386 is a 32bit CPU architecture, and x86_64 is a 64-bit architecture. –  trolle3000 Aug 10 '10 at 8:18
1  
@sugar you may also see in some places i486, i586 or i686 these are also 32bit but include more instructions. –  AndrejaKo Aug 10 '10 at 8:46
show 1 more comment

If you were to do any actions using CMD scripting in Windows, you could start the batch file something like this:

@echo off

if %PROCESSOR_ARCHITECTURE% == x86 (
goto :x86
) else (
goto :x64
)

:x86
start "foo.exe"
goto :eof

:x64
start "bar.exe"
goto :eof
share|improve this answer
    
just what i needed –  ppumkin May 21 '12 at 15:19
add comment

Under Windows:

The GUI Way

  1. Press Win+R to open the Run... Dialog
  2. Enter winmsd
  3. Look for row Processor or System type

If they begin with x86 you have 32-Bit otherwise you have 64-Bit

Using cmd.exe
Enter SET PROCESSOR_ARCHITECTURE
x86 means 32-Bit, otherwise it's 64-Bit

Using Powershell
Enter $env:PROCESSOR_ARCHITECTURE
Meaning is the same as with using cmd.exe

Beware
There are two different types of 64-Bit architectures.
One is AMD64 for x64 the other is ia64 for Itanium (not sure this value is exactly like that, never worked with any of them)

share|improve this answer
    
ia64 is for Itanium processors which are completely different architecture and are not part of x86 family. They can run x86 programs but their 64 bit mode is basically completely different from x86 and requires different compilers and whole low-level programming. Amd64 is named after AMD because they made 64bit extensions to x86 instruction set. Their processors are still x86 but can work with 64bits and they are much more related to 32bit x86 than itanium. –  AndrejaKo Aug 10 '10 at 8:50
add comment

Stupid ways for Linux:

  1. To identify the kernel, cat /proc/kallsyms, check whether the symbols for kernel is 32 bits wide or 64 bits wide. Then you will know the kernel is 32 bits or 64bits.

  2. For the user application, just run: $file /bin/ls To check whether the ls command is 32 bits or 64bits, since the os may contain both 32bits and 64bits applications, this may not be wrong.

share|improve this answer
add comment

@paradroid - Thanks for the brainstorm ^^

I now use this for a Java program I distribute which needs Windows users to utilize javac. This script checks their architecture and opens the download to the proper version of JDK in their default browser...

@echo off

Title Dragon's JDK Downloader - Runedev Script Compiler

goto menu
:menu
echo.
echo What would you like to do?
echo.
echo 1. Download JDK?
echo 2. Compile Scripts?
echo 3. Quit
echo.

:choice
set /P C=1,2,3?
if "%C%"=="3" goto quit
if "%C%"=="2" goto compile
if "%C%"=="1" goto download
goto choice

:download
if %PROCESSOR_ARCHITECTURE% == x86 (
goto :x86
) else (
goto :x64
)

:x86
START http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u23-windows-i586.exe?BundledLineItemUUID=q9.J_hCupJ8AAAEsXThZDfyg&OrderID=zHCJ_hCujC0AAAEsUjhZDfyg&ProductID=_omJ_hCwMp4AAAEsQIMcKluK&FileName=/jdk-6u23-windows-i586.exe
goto :eof

:x64
START http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u23-windows-x64.exe?BundledLineItemUUID=CMyJ_hCu.vEAAAEsWu9ZDfyf&OrderID=RZ.J_hCuAVkAAAEsUO9ZDfyf&ProductID=ZUuJ_hCwEmwAAAEsOoMcKluK&FileName=/jdk-6u23-windows-x64.exe
goto :eof

:compile
SET cc=javac
SET cflags=
SET scripts=Scripts
SET scriptspre=%scripts%\Precompiled
SET jarpathfile=Settings\path.txt

IF NOT EXIST "%jarpathfile%" (
   ECHO Path file does not exist. Please run Runedev and try again.
   GOTO menu
)

FOR /F "delims=" %%G IN (%jarpathfile%) DO SET jarpath=%%G

CALL FindJDK.bat

IF NOT EXIST %scripts%\*.java (
   ECHO No .java script source files found.
   GOTO menu
)

ECHO Compiling scripts
ECHO. > "%scripts%\.class"
DEL /F /Q "%scripts%\*.class" > NUL
"%cc%" %cflags% -cp "%jarpath%" %scripts%\*.java

:end
PAUSE
EXIT

:quit
exit
:end
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.