≡ Menu

HowTo: Is My Linux Kernel (and CPU) 32-Bit or 64-Bit?

Question: How do I check whether my Linux operating system is running on 32-bit or 64-bit?

Answer: If you’ve installed it, you should know, as the installation CD (or ISO image) for a 32-bit Linux OS and 64-bit Linux OS are different. Let us assume that your sysadmin installed the OS, and you didn’t know whether he used a 32-bit or 64-bit Linux.

Method 1: Use uname -a to check 32-bit or 64-bit

Linux provides a command called uname, which prints system information including kernel version and whether kernel is 32 bit or 64 bit.

If the uname -a output displays x86_64, then the system is running 64bit Linux kernel.

If the uname -a output displays i386/i486/i586/i686, then the system is running 32bit Linux kernel.

The following example indicates that it is running on 64-bit Linux OS.

$ uname -a
Linux ora100 2.6.5-7.252-smp #1 SMP Tue Feb 14 11:11:04 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux

You can also do “uname -m”, which displays only the 64 or 32 bit part as shown below.

$ uname -m
x86_64

Method 2: Use /proc/cpuinfo

Execute “less /proc/cpuinfo” command to determine if the CPU on the server is 64 bit or 32 bit.

cpuinfo file displays the kernel bits in Linux operating system.

Execute the following command and if you see “lm” in the output, you have a 64 bit CPU based system.

$ grep flags /proc/cpuinfo

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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Ganesh December 8, 2010, 3:57 am

    hi ,
    There is one utility called “sysinfo.”
    You have to install this utility.

    On Ubuntu
    $sudo apt-get install sysinfo
    $sysinfo

    You will get the graphical infomation about ypur oprating system,hardware, ect..

    I hope this info help you.

  • karthik December 8, 2010, 3:52 pm

    getconf LONG_BIT will give the exact result.

  • Ace December 8, 2010, 5:39 pm

    Or on CentOS, you can type in >arch

  • Selva December 9, 2010, 6:36 pm

    Just type $ file /bin/ls
    you will get the following.
    “/bin/ls: ELF 32-bit MSB ”
    Which stats that you are using 32 bit. This can run in any *nix

  • Nelson December 11, 2010, 3:54 pm

    Selva, no.
    You can use a 64 bits kernel with a 32 bits userland and your test fill give an incorrect information (saying that the binary is 32 bits while in fact it’s running with 64 bits).

  • Manoj Venugopal December 20, 2010, 3:57 am

    The best way to find this is with getconf command
    # getconf LONG_BIT
    this will give you and output

  • nidhi June 12, 2012, 3:07 am

    Can someone please clarify these long pending question in my mid..would be really grateful if its sorted here..
    What do i mean when i say i have 32/64 bit architecture , 32/64 bit OS, 32/64 bit compiler. How are they related what is compatible with other? How its related to a pointer’s size in c program? How 32/64 bit architecture thing is related to virtual address space that is available for an os on that architecture.

    I know a little about this all but in bits and pieces, would be really great if its told in a manner thats uniqueness of TGS. 🙂

  • Anonymous November 4, 2013, 11:58 am

    getconf LONG_BIT will give correct info