Commands Check Linux OS is 64 / 32 bit and CPU 64 / 32 Bit

May 13, 2011 | By
| Reply More

You will need to use the 'uname' command to check the system information including kernel version and whether kernel is 32 bit or 64 bit. In order to check if the CPU is 32 or 64 bit, you need to run the less /proc/cpuinfo command. More commands and details are given below:

How to tell if linux (kernel) is 64 bit or 32 bit

Type the following command at the terminal or shell:

#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

In above output x86_64 GNU/Linux indicates that you've a 64bit Linux kernel running. If you see i386/i486/i586/i686 it is a 32 bit kernel.

You can use getconf command to get kernel bit information:

#getconf LONG_BIT

which returns either 32 or 64

Another option is to use ld command:

#ld -V

Yet another method is to use the file command:

#cd /bin
#file mkdir
mkdir: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped

How to tell if linux (cpu) is 64 bit or 32 Bit

You can use the /proc/cpuinfo file:

# less /proc/cpuinfo
Output:
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 5
model name : AMD Opteron (tm) Processor 848
stepping : 10
cpu MHz : 2197.161
cache size : 1024 KB
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall
nx mmxext lm 3dnowext 3dnow
bogomips : 4308.99
TLB size : 1088 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp
processor : 1
vendor_id : AuthenticAMD
cpu family : 15
model : 5

model name : AMD Opteron (tm) Processor 848

Use "flags" parameter to find out CPU. Output will show various values. Among them, one is named "tm(transparent mode)" or "rm(real mode)" or "lm(long mode)"

1. rm means: 16 bit processor
2. tm means: 32 bit processor
3. lm means: 64 bit processor

You can use grep command to check the CPU flag information from /proc/cpuinfo file.

# grep flags /proc/cpuinfo
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

Or

#cat /proc/cpuinfo | grep flags | grep -o lm

Filed Under : LINUX COMMANDS, LINUX HOWTO

Tagged With :

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.