Recent days all the major Linux operating system support two type of architecture. Those are 32 bit architecture and 64 bit architecture. There is no explicit option available to know which type of architecture you are working. Operating System GUI has option to see this facility even in LINUX knowing everything from Command line has the advantage. Below commands help you to find the Linux operating system architecture. Here i used CentOS release 6.3 to make this article.
1. uname -a -- This command will display the kernel architecture whether it 32 bit or 64 bit. Output of this command vary depends on the hardware architecture.
For Intel 32 bit - i686 or x86
For Intel 64 bit - x86-64
[fedo@localhost ~]$ uname -m
x86_64
2. getconf LONG_BIT -- We can use this command also to get the architecture
[fedo@localhost ~]$ getconf LONG_BIT
64
3. arch -- This command also help to find the architecture
[fedo@localhost workspace]$ arch
x86_64
4. lscpu -- you can get the all the details about OS and CPU support using this command
[fedo@localhost ~]$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Stepping: 9
CPU MHz: 3192.839
BogoMIPS: 6385.67
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0
5. If you want to get OS architecture through C/C++ program you can use below code
Program:
#include <stdio.h>
int main()
{
printf("%d bit \n", __WORDSIZE);
return 0;
}
Output:
64 bit
For Intel 32 bit - i686 or x86
For Intel 64 bit - x86-64
[fedo@localhost ~]$ uname -m
x86_64
2. getconf LONG_BIT -- We can use this command also to get the architecture
[fedo@localhost ~]$ getconf LONG_BIT
64
3. arch -- This command also help to find the architecture
[fedo@localhost workspace]$ arch
x86_64
[fedo@localhost ~]$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Stepping: 9
CPU MHz: 3192.839
BogoMIPS: 6385.67
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0
5. If you want to get OS architecture through C/C++ program you can use below code
Program:
#include <stdio.h>
int main()
{
printf("%d bit \n", __WORDSIZE);
return 0;
}
Output:
64 bit
No comments:
Post a Comment