Q. How can I check if my server is running on a 64 bit processor and running 64 bit OS or 32 bit operating system?
Before answering above question we have to understand below points.
We can run a 32-bit Operating system on a 64 bit processor/system.
We can run a 64-bit operating system on a 64 bit processor/system.
We cannot run a 64-bit operating system on a 32-bit processor/system.
We can run a 32-bit operating system on a 32-bit processor/system.
Once we are clear about the above 4 points then we can see if our machine have a 64 bit processor or not.
How to check if my CPU is a 64-bit supported processor or not?
There are two commands to check if it’s a 64 bit processor or not
Option 1 : use lscpu command to check if it supports multiple CPU operation modes(either 16, 32 or 64 bit mode).
as a normal/root user execute below command
lscpu | grep op-mode
Sample output on a 64-bit processor
firstname.lastname@example.org:~$ lscpu | grep op-mode CPU op-mode(s): 32-bit, 64-bit
Sample output on a 32-bit processor
[surendra@www ~]$ lscpu | grep op-mode CPU op-mode(s): 32-bit
If you observe the first output will say that your CPU supports both 32-bit as well as 64 bit operating systems. This indicates that it’s 64-bit processor from our above 4 rules. But in the second machine it say’s only 32-bit CPU mode which indicates it’s a 32 bit processor.
Option 2: Use proc file system file CPU info to get the processor type.
grep -w lm /proc/cpuinfo
Sample output on a 64-bit processor when searching for lm(long mode) bit is set or not
grep -w lm /proc/cpuinfo flags : tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr
Sample output on a 32-bit processor when search for lm(long mode) bit.
grep -w lm /proc/cpuinfo
[surendra@www ~]$ grep lm /proc/cpuinfo
If you don’t get any output that indicates it’s not a 64 bit processor.
How to check if my Operating system is a 64-bit or 32-bit?
Before knowing about this you should know about i386, i486 etc naming convention.
What is difference between i386, i486, i586, and i686 OS?
They are the names given by software industry to some software’s for different Intel architectures. If we say i386, it’s Intel 80386 processor, also known as the i386, or just 386, was a 32-bit microprocessor introduced by Intel in 1985. If I say i486 it’s an Intel 80486, i586 it’s a 80586 and i686 it’s a 80686 processor. In short they are called as x86 family which are of 32 bit processor. And for 64 bit OS you will get x86_64.
Option 1: check with uname command if your OS is 32 bit or 64 bit.
Option 2: Check with lscpu command as below.
lscpu | grep -i arch
Option 3: Check with getconf command as shown below
Sample output for 64 bit OS:
email@example.com:~$ uname -m x86_64 firstname.lastname@example.org:~$ uname -p x86_64
email@example.com:~$ lscpu | grep -i arch
firstname.lastname@example.org:~$ getconf LONG_BIT 64
Sample output for 32 bit OS
[surendra@www ~]$ uname -m i686 [surendra@www ~]$ uname -p i686 [surendra@www ~]$ lscpu | grep -i arch
Architecture: i686 [surendra@www ~]$ getconf LONG_BIT 32
Please let us know if you know any other way to get OS and Processor processing bit details.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix- June 29, 2020
- FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018