Some times it is very important to know whether the Server’s CPU Architecture is of 32-bit or 64-bit because 64-bit applications can not run on 32-bit system, whereas 32-bit application can easily be run on 64-bit system.
One can determine Linux System CPU architecture using the file /proc/cpuinfo , example is shown below :
[root@localhost ~]# cat /proc/cpuinfo | grep -i flags 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 up rep_good pni monitor ssse3 lahf_lm
In the above output, we could either see lm, tm or rm, these flags indicates about CPU architecture.
Where :
- lm : Long Mode (64 bit)
- tm : Transparent Mode ( 32 bit)
- rm : Real Mode (16 bit)
So as per above output, Server’s CPU is of 64 bit.
Apart from /proc/cpuinfo, we can also check the CPU architecture using lscpu command, in the output look for CPU op-modes(s). We can also use lshw command to view CPU architecture, execute following command and in the output look for width parameter,
[root@localhost ~]# lshw --class processor
Find CPU architecture using dmidecode command
Run the beneath dmidecode command and in the output look for “Characteristics:” parameter which will show whether CPU architecture is 64-bit or 32-bit
[root@localhost ~]# dmidecode -t processor
Determine whether a given Linux is 32 bit or 64 bit?
We can find the whether installed Linux system on which we are working is 32-bit or 64-bit using commands like lscpu, ‘uname -m‘ and getconf
[root@localhost ~]# lscpu
Output will be something like below and look for Architecture, as per output below 64-bit Linux is installed on the system,
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 37
Stepping: 5
CPU MHz: 933.000
BogoMIPS: 4787.82
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
[root@localhost ~]# uname -m x86_64
x86_64 –> 64-bit kernel
i686 –> 32-bit kernel
Above Command will display whether Kernel Version is 32 bit or 64 bit
[root@localhost ~]# getconf LONG_BIT 64
with help of getconf command we can also find whether the installed Linux is of 32-bit or 64-bit