≡ Menu

Linux: Find If Processor (CPU) is 64 bit / 32 bit [long mode ~ lm]

I am a new Linux system user. How do I determine if my CPU is 64bit or not on a Linux operating systems using command line option? How can I check Linux kernel is in 32 bit or 64 bit mode?

You need to use the following commands to find out information about Linux kernel and CPU architecture:

    Tutorial details
    DifficultyEasy (rss)
    Root privilegesYes
    RequirementsLinux
    Estimated completion time2m

  1. getconf LONG_BIT command: This command check if the OS (kernel) is 32 bit or 64 bit.
  2. uname command: This command prints system information including kernel version and whether kernel (os) is 32 bit or 64 bit.
  3. /proc/cpuinfo file: Use this file to determine if CPU is 64 bit or 32 bit i.e. find out CPU architecture.

Example - Find out if running Linux kernel (OS) is 32 or 64 bit

Type the following command at the terminal:
$ uname -a
Sample output:

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

x86_64 GNU/Linux indicates that you've a 64bit Linux kernel running. If you use see i386/i486/i586/i686 it is a 32 bit kernel. You can also use the following command to find out if Linux kernel is running in 32bit or 64bit mode:
$ getconf LONG_BIT
Sample outputs:

64

How do I find out CPU is 32bit or 64bit on a Linux system?

Simply type the following grep command and if you see lm in output, you have a 64 bit CPU based system:
$ grep flags /proc/cpuinfo
OR
$ grep -o -w 'lm' /proc/cpuinfo | sort -u
Output:

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
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

(Scroll to see all flags)

More about CPU modes:

  • lm flag means Long mode cpu - 64 bit CPU
  • Real mode 16 bit CPU
  • Protected Mode is 32-bit CPU

Demo

Animated gif 01: Linux Find Out If Processor / CPU  and OS (kernel) is in 32 or 64 bit mode

Animated gif 01: Linux Find Out If Processor / CPU and OS (kernel) is in 32 or 64 bit mode

See also:
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 63 comments… add one }

  • tushar January 29, 2008, 6:05 am

    Thanks for this short and sweet information without too much garbage….

    • Saurabh November 10, 2011, 7:11 am

      uname -m

      • josh December 21, 2011, 5:21 pm

        lshw -class processor

  • dGuru March 27, 2008, 8:14 am

    all methods above are wrong. If the system was installed with 32bit OS the result will always be 32 unless it has a 64bit Linux running.

    The correct way to do is:

    cat /proc/cpuinfo

    and look for flag “lm” in the flags: column. If it’s there then it’s 64bit CPU no matter Intel or AMD.

    • anonymous May 11, 2010, 1:58 am

      Man, read the post! This shows how to find out if the KERNEL is a 64bit kernel and also if the CPU is 64bit. READ.

      • Niels Dettenbach October 26, 2010, 2:33 pm

        please read postings more down – this is not correct in any case too…

        cheers,

        Niels.

        http://www.dettenbach.de

  • Mukta Jindal November 11, 2008, 7:52 am

    Thanks for this quick information. It was really helpful !!!

  • Amdocs December 25, 2008, 4:39 pm

    You can also try this to find out if your CPU/Processor is 32 bit or 64 bit:
    # getconf LONG_BIT
    32

    • Amit September 14, 2010, 12:13 pm

      Thanks

    • Mahadev October 20, 2010, 3:38 pm

      Thanks a lot. Good One

    • LinuxAdmin December 29, 2010, 10:05 pm

      getconf LONG_BIT
      which returns either 32 or 64
      says nothing about the cpu capabilities, just the os that is running. ( you can run 32bit os on 64bit capable chip, but not the other way arround) the ;
      > cat /proc/cpuinfo
      and looking for lm seems to tell you if it is capable of 64bit
      and it also tells you the chip and model # which you can google and verify.

    • Vasant April 19, 2012, 5:07 am

      Thanks, this is the great post.

    • Kapil October 14, 2013, 5:14 am

      Bingo! Thanks a lot for the perfect answer!

    • Vinay June 23, 2014, 8:27 pm

      Thanks a lot dude

  • Max January 8, 2009, 6:42 pm

    Yeah… my power5 (ppc64) returns 32 for
    getconf LONG_BIT

    • Jeremy September 5, 2011, 3:54 am

      That’s because you are running a 32bit kernel.

  • BalaKumar January 15, 2009, 4:33 am

    Thank U for Your Great post

  • Core User January 17, 2009, 3:06 pm

    Awesome! Exactly what i needed.
    Good Job Man!!!

  • saharey February 2, 2009, 5:59 am

    I this info is confusing in my Linux box when I run this command:
    cat /proc/cpuinfo
    flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx lm constant_tsc up pni cx16 lahf_lm

    and my uname -a command gives this info:

    #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux

    now what should I conclude does I am using both 32 and 64 bit?

    • eZH October 26, 2010, 12:54 pm

      You installed i386 (32bit arch) kernel on 64bit (lm) machine

      That’s what I’m going to do too, cause nsviewer is 32bit and it gets buggy and eats too much proc time on 64 machine.

  • Shlomi Aflalo February 4, 2009, 5:38 pm

    saharey – it means that you are running a 32 bit kernel on a 64 bit cpu.

  • neelesh March 11, 2009, 1:42 pm

    the info was great and very much helped me…
    specially the one from ‘dguru’
    thankyou once again….

  • sfcg April 10, 2009, 8:26 pm

    cat /usr/include/asm/cpufeature.h

    This will show you all the pertinent flags regarding your motherboards socket. If you have an AMD read the AMD defined features. If you have an Intel read the Intel defined features. I find that the ‘lm’ flag does show up on intel chips however so keep that in mind.

  • Ivan May 18, 2009, 11:46 am

    What about:

    # getconf LONG_BIT
    32
    # grep flags /proc/cpuinfo
    flags : fpu vme de pse tsc msr pae mce cx8 apic 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 est cid cx16 xtpr lahf_lm

    I know that this machine has 32bit processor, however, the lm flag is present. Does this make the lm flag unreliable for determining the cpu architecture?

  • Aji July 10, 2009, 7:19 am

    What about

    # getconf LONG_BIT
    32

    # 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 est cid 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 est cid cx16 xtpr lahf_lm

    and
    # uname -a
    Linux 2.6.15-1.2054_FC5smp #1 SMP Tue Mar 14 16:05:46 EST 2006 i686 i686 i386 GNU/Linux

  • Praveen mavi July 14, 2009, 12:28 am

    very thankfull to all for very authorative answer

  • omidreza July 27, 2009, 7:49 am

    Thanks to all.
    It’s very helpful.

  • ozy August 18, 2009, 2:49 pm

    # getconf LONG_BIT
    it’s tell you whether you’re use 32-bit or 64-bit kernel not your proccessor.
    32-bit kernel returns 32, even on 64-bit processor

  • Rahul Teni August 18, 2009, 4:21 pm

    This was very helpful.

    Anyways i checked with cat /proc/cpuinfo and grep flags /proc/cpuinfo it returns the same thing though i am running it on32 bit operating system (ubuntu)

    Anyways thanks a lot for useful information

  • Billa August 31, 2009, 3:20 pm

    very helpful …thank you guys

  • Rishabh September 12, 2009, 5:46 am

    this really helped me, and i found i was running a 64 bit processor
    cheers!!!!!!!!!!!!

  • wanville September 24, 2009, 2:06 pm

    try this

    getconf -a

  • ray October 20, 2009, 3:23 am

    try these commands
    file /bin/dd #file determine the file type
    [ray@test]$lsb_release
    LSB Version: :core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch
    [root@localhost ~]# lsb_release
    LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarc

    [ray@test]$ uname -m
    it`s tell us whether we’re use 32-bit or 64-bit kernel
    The Enterprise CPU support ia32bit and amd64bit currently.

  • Jamieson November 1, 2009, 10:33 pm

    Ray, those only show if you are running a 32/64 bit OS, not the processor info. You can run 32 and 64 bit software at the same time on the same system as part of the same OS on a 64 bit processor, but you can’t run 64 bit software on 32 bit processor. (You can’t generally run 64 bit software on a 64 bit platform if your kernel is only 32 bits, however.)

    You can run a 64 bit kernel with a 32 bit OS on a 64 bit processor, but not by default.

    cat /proc/cpuinfo |grep ” lm” will tell you if you have the lm flag, and thus if your processor is 64 bit.

    file /bin/dd just shows you that dd is a 32 or 64 bit executable. It could be a 32 bit executable in a 64 bit OS or a 32 bit OS with either kernel as well. However, it’s unlikely, so this is a good test of what your OS is.

    uname -a should show you if you have 64 bit kernel. If it doesn’t say 64 somewhere, it’s not 64 bit. Commonly 32-bit would be either i686 for most Linuxes and ia32 for RH Linux and derivatives.

    Since unfortunately far too frequently people run 32 bit kernels and operating systems on 64 bit hardware, it’s important to make the distinction between knowing what your hardware can actually support versus what it’s running right now. The ONLY quick way to know hardware capabilities is via /proc/cpuinfo. All of the other methods mentioned above are checking the OS to see what it’s doing.

    On the other hand, you can’t run a 64 bit OS on a 32 bit processor (without virtualizing the processor itself) so if you have a 64 bit OS, then you must also have a 64 bit processor. If you have a 32 bit OS, then you must check a bit further because you might not be taking advantage of all of the powerful capabilities of your platform.

    • al November 8, 2011, 10:29 pm

      Big thanks.

  • Sniper7 November 28, 2009, 7:03 pm

    Hi there.

    An annoying issue for me is that my system outputs “unknown” when I try to ask about CPU info with “uname -p” command. Although “cat /proc/cpuinfo” and “dmesg | grep -i cpu” puttin’ out the correct things, “uname” won’t it at all.

    Does anyone know how to make” uname” to tell me what i ask from?

    Cheers, S7.

  • Niels Dettenbach February 12, 2010, 2:28 pm

    > You need to run the less /proc/cpuinfo command to determine if CPU is 64 bit or not.
    sorry, but this is not correct.
    > flag: lm
    This won’t help to find out if your CPU is able to run 64bit kernels or 64bit capable anymore.

    Especially newer Intels / Xeons are still 64bit but there is no such easy way (/proc/cpuinfo flags or uname) to find out if it runs 64bit kernels or not (i.e. there is no lm (long mode)).

    Best way in such cases is to run a google against the original CPU docs/specs or try a small live 64bit linux kernel to boot.

    If i’m wrong and someone has a better way feel free to correct me.

    cheers,

    Niels.
    http://syndicat.com

  • Niels Dettenbach February 13, 2010, 8:33 am

    Newer Intels / Xeons doest have the ‘lm” flag but are able to run 64bit kernels too.

    This means to find out if a CPU is 64bit capable there is no such easy way.

    You have to run a google against the CPU specs / docs or to try a 64bit system (i.e. a small live system from CD or USB) to boot.

    uname just tells you what kind of arch the software (kernel) is – which might be independent from the CPU capabilities (many 64bit CPUS are still capable to run 32bit code) .

    cheers,

    Niels.
    http://www.syndicat.com

  • Ivan March 15, 2010, 8:29 pm

    thanx

  • marc August 5, 2010, 7:59 pm

    dmidecode -t 4 (as root)

  • Niels Dettenbach August 6, 2010, 5:30 am

    Yes, dmidecode gives an additional option to find out if a CPU is 64-bit capable, but dmidecode is’nt right or working here on more or less environments / machines.

    Additionaly man demidecode says:
    “more often or not information contained in DMI tables is inaccurate, incomplete or wrong”
    and
    “…the presented information possibly unreliable”

    This might have different reasons, from buggy or incomplete BIOS implementations, DMI tables to partly “incompatible” hardware . So i saw f.i. different results here just before and after a BIOS update…

    But on most newer / modern (modular) servers from the main vendors the BIOS / DMI implementation seems to be working as expected as more and more of their management tools are depending from it.

  • Snowbird December 27, 2010, 10:29 pm

    Forget everything and just use in your shell window
    lshv

    If you dont have this try installing it (yum install lshv)
    this utility will give you more than what you want to know :)

    you can also get html report of your complete hardware info by typing:

    lshv -html > report.html

  • Niels Dettenbach December 30, 2010, 8:19 am

    afaik lshv uses DMI too – so it does not get more informations out then dmidecode or other described sources here – just brings it into some “nice” (may just overloaded in this scenario) HTML stuff). I assume that is usualy not that what peoples want if they want to script something…

    Not at least: as dmidecode and other DMI-tools it works only if the kernel provides DMI access / drivers to the regarding hardware.

    As i stated before – there is no reliable (!) way to find out if a CPU (which is not shown as 64bit capable by all these tools and commands) is NOT a 64bit capable one. dmidecode (DMI) is (afaik) the most reliable source on system side but not correct in each case.

    In such cases you have to:

    – dig after the (original) CPU spec docs
    OR
    – just try to start a 64bit system (i.e. a Live CD or USB)

    cheers,

    Niels Dettenbach.
    http://dettenbach.de

  • Manoj March 2, 2011, 11:37 am

    This can also be achieved by following:

    uname -i
    or
    uname -m

    Corrent me if am wrong :)

    • Niels Dettenbach March 3, 2011, 8:02 am

      No, this is not correct as you can read in the discussions here.

      “uname” just gives you out how your sys was compiled – not the hardware specs. If it IS a 64 then you (should) HAVE a 64bit (capable) CPU – but not vice versa!

      Just to sum up the discussion here: To find out if a cpu id 32 or 64 bit you have the following options – from less reeliablest to reliable:

      – uname
      – getconf LONG_BIT / cat /usr/include/asm/cpufeature.h
      – cat /proc/cpuinfo
      – DMI / dmidecode
      – try to boot a 64bit linux (i.e. live system) or read the public specs of a CPU

      OK?
      This means uname is the option with the lowest (!) trust in this question.

      cheers,

      Niels.

  • Manoj March 3, 2011, 8:09 am

    Yes you are correct about “getconf LONG_BIT” but manual says:

    man uname

    -m, –machine
    print the machine hardware name

    Machine hardware name will be architecture….

    Thanks,
    Manoj

  • Niels Dettenbach March 3, 2011, 9:19 am

    > -m, –machine
    > print the machine hardware name
    This is correct – but not your interpretation of it.

    If you run i.e. a i386 sys on a 64 bit capable box you can get ‘i386′ but not ‘x86_64′ or something 64bit related. But this all was still topic in this thread here:
    http://www.cyberciti.biz/tips/how-do-i-find-out-if-my-server-cpu-can-run-a-64-bit-kernel-version-apps-or-not.html

    The only thing you can say if a 64bit system runs on that hardware (and so will print out uname -m implicite) it IS 64bit capable.

    And in a very precise way even dmidecode doesn’t gives you are reliable answer as there are incomplete or incorrect dmi implementations out there. So the most / only reliable way is to try boot a 64bit OS.

    cheers,

    Niels.

  • typhoon March 22, 2011, 5:08 am

    # getconf LONG_BIT seems only os 32 or 64 bit that running on your pc
    it must not be cpu 32 or 64 bit
    may need command cat /pro/cpuinfo for more information about cpu

    • Niels Dettenbach March 22, 2011, 12:05 pm

      yes,

      BUT

      cat /proc/cpuinfo

      does not give a reliable information about 64bit cap. cpu hardware too as several different CPU types gives different flags here etc. (see the thread). This means you have do dig into the CPU specs from the vendor to be *really* shure (or try to start a 64bit OS).

  • Shiva April 10, 2011, 7:11 pm

    you info was very helpful..

  • dhanalakshmi May 18, 2011, 10:54 am

    from this command :
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts est tm2

    from this command :
    Linux dhanalakshmi 2.6.29.1-desktop-4mnb #1 SMP Mon Apr 20 18:57:56 EDT 2009 i686 Intel(R) Pentium(R) M processor 2.00GHz GNU/Linux

    Can you tell me please
    what os is mine ?

  • Sniper May 19, 2011, 12:26 am

    @ dhanalakshmi:
    From the output of “uname -a” it seems that your OS is most likely a 32 bit Debian (or ArchLinux, or Linux Mint; more probable one of the first two) on 2.6.29.1 custom-built 32-bit SMP kernel running on a 2 GHz laptop computer.

  • Bill June 14, 2011, 9:02 pm

    Thank you Jamieson for the most useful, polite and comprehensive reply. I so wish the internet had more ppl like you and less…

    IMO It put a lot of the others to shame who seem to like to chitchat on stuff they don’t really know (yes, this was not polite, on purpose).

    /Bill

  • nicole December 8, 2011, 2:06 pm

    IBM Power 5 510
    uname -m
    ppc64

    getconf LONG_BIT
    32
    Loaded OS
    RHEL 5.6 PPC

    why it says 32 bit?

  • josh December 21, 2011, 5:21 pm

    simply use the following command
    lshw -class processor

  • Thomas Rebtun June 4, 2012, 4:19 pm

    Thanks OP and huge thanks @josh for his contribution : lshw -class processor

  • anonymity June 13, 2012, 5:28 am

    try

    grep --color=always -iw lm /proc/cpuinfo

    it colors up the “lm” (long mode tag) in red , so its easy to spot

    • nixCraft August 23, 2012, 2:27 pm

      Also the following will only output if it is 64bit cpu:

      grep -o --color=always -iw lm /proc/cpuinfo | uniq
  • NITESH KUMAR PANDEY August 8, 2012, 1:52 pm

    Hi,
    how can i check dual core ,core 2 duo or i3 processor in computer ( Linux operating system)

    • Niels Dettenbach August 8, 2012, 4:45 pm

      Hi Nitesh,

      it is not really clear what “CPUs” and “Cores” are in any practice case.

      It is not possible to count the number of “cpu stones” in a machine as this is not really clear in any case, but the number of cores could be counted:

      To count the number of “CPUs”:

      $dmidecode -t processor

      or just the number of CPUs:
      $dmidecode -t processor |grep “ID” | wc -l

      to count the cores (or “core threads”) you need two things:
      1.) You need to boot / have booted any SMP capable kernel (most current distros today have SMP kernels by default) – you might check this with:

      $uname -a
      gives something like:
      Linux gongo 3.5.0-niels #1 SMP PREEMPT

      2.) then read the content of the cpuinfo system variable:

      $cat /proc/cpuinfo
      This gives a detailed description of each core or thread

      if you “just” want to know the exactly number of cores, you might do something like (counted from CPU 0!):

      $cat /proc/cpuinfo |grep processor | cut -d “:” -f 2 | tail -n 1

      If you have a typical dual core the last command should show you a “1”.

      good luck,

      Niels.

  • aurel April 17, 2013, 3:42 pm

    Big thanks for this. very interesting.

  • beansoy June 28, 2013, 5:42 am

    In short, if you want to check if the OS is 32 bit or 64 bit, use these commands:
    – lscpu
    – getconf LONG_BIT
    – uname

    if you’re interested in the CPU architecture use these commands:
    – /proc/cpuinfo
    – hwinfo
    – lshw

Leave a Comment