img

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

September 8, 2019

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:

    [donotprint][/donotprint]
  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

NOTE: If you are running 32 bit cpu, you will see 32 bit as output.

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

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
See also:

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Article Tags:
Article Categories:
How To

Comments are closed.