Sunday, May 12, 2013

To Check if Your Linux/Machine is 32 bit or 64 bit

Sometimes people forward me an address of machine I need to maintain. For windows it's pretty easy, just right click on 'Computer' and choose 'Properties'. But some of them it's linux that I need to maintain through ssh. Although normally our application requested a 64 bit environment, but that's not always the case. I need to check if the environment fit our needs.
"uname -a" will give me a pretty long information

Linux tiny-ubuntu 3.8.0-19-generic #30-Ubuntu SMP Wed May 1  16:35:23 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux

We just need a fraction of those information only, "uname -m" will produce:
x86_64 for 64-bit kernel
i686      for 32-bit kernel

But remember, we can have a 32-bit Linux installed in 64-bit CPU, I never try the other way around...
So, checking CPU information, you can achieve it by using this command:"cat /proc/cpuinfo"

desson@tiny-ubuntu:~$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz
stepping        : 9
cpu MHz         : 2489.318
cache size      : 6144 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
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 rdtscp lm constant_tsc rep_good nopl pni monitor ssse3 lahf_lm
bogomips        : 4978.63
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management: