6 Ways To Identify CPU Architecture On Linux OS
Two modern CPU processor types exist in today’s modern computing systems. These are the 32 bit and 64-bit processors. A 32-bit system can access 232 memory addresses, i.e 4 GB of RAM or physical memory whereas a 64-bit system can access 264 memory addresses, i.e actually 18-Billion GB of RAM. In short, a 32-bit processor will not detect more than 4GB of RAM on the system. 64-bit processors are backward-compatible and can run 32-bit software. This means that you can install a 32-bit operating system on a 64-bit computer. Most Linux software packages are compiled to run on either of the two processor architectures which is indicated in the name of the package itself. Identify CPU Architecture On Linux Operating system.
In this article, we will show you four ways to determine which processor architecture your operating system is running on.
6 Ways to Identify CPU Architecture on Linux
Method1: Using uname command
Use uname command with the -m, -i or -p option to determine the machine architecture or the instruction set for the processor the operating system is running on.
Given below are examples of the uname command using both options.
[root@sahil-centos7 ~]# uname -m x86_64 [root@sahil-centos7 ~]# uname -i x86_64 [root@sahil-centos7 ~]# uname -p x86_64
Method2: Using lscpu command
The lscpu command provides some useful information about the system processor. This includes the op-mode or operating mode which determines if the system can operate in 32 bit or 64-bit modes as well as the processor architecture
Given below is the output of the lscpu command on a 64-bit system.
[root@sahil-centos7 ~]# lscpu | grep op-mode CPU op-mode(s): 32-bit, 64-bit [root@sahil-centos7 ~]# [root@sahil-centos7 ~]# lscpu | grep Architecture Architecture: x86_64
Since we can see both 32-bit as well as 64-bit modes available, we can confirm that this is a 64-bit system. Also, we see that the architecture type is x86_64 indicative of a 64-bit system.
Given below is the output of the lscpu command on a 32-bit system.
[root@sahil-rhel4 ~]# lscpu | grep op-mode CPU op-mode(s): 32-bit [root@sahil-rhel4 ~]# lscpu | grep Architecture Architecture: i686
Method3: Using /proc/cpuinfo file
/proc/cpuinfo files contains useful information about the CPUs on the system. This information includes some flags and each flag indicates some feature or the other.
One such flag is lm (long mode). If this flag is set or available in the flags section of the /proc/cpuinfo output then that implies that you are working on a 64-bit system.
Let’s run this command on a 64-bit system to verify.
[root@sahil-centos7 ~]# grep -w lm /proc/cpuinfo flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
We see two flags sections in the above output because the system I’m working on has two CPU cores
Method4: Using dmidecode
Use the dmidecode command with the –type processor option. Towards the end of the processor information section, under Characteristics, you should see the line “64-bit capable” if you are working on a 64-bit system. That’s the simple method to identify CPU Architecture on Linux OS by default dmidecode is installed.
[root@sahil-centos7 ~]# dmidecode --type processor # dmidecode 3.0 Scanning /dev/mem for entry point. SMBIOS 2.7 present. Handle 0x0004, DMI type 4, 42 bytes Processor Information Socket Designation: CPU #000 Type: Central Processor Family: Unknown Manufacturer: GenuineIntel ID: D4 06 03 00 FF FB AB 0F Version: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz Voltage: 3.3 V External Clock: Unknown Max Speed: 30000 MHz Current Speed: 2300 MHz Status: Populated, Enabled Upgrade: ZIF Socket L1 Cache Handle: 0x0094 L2 Cache Handle: 0x0114 L3 Cache Handle: Not Provided Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Core Count: 1 Core Enabled: 1 Characteristics: 64-bit capable Execute Protection
Method5: Using getconf
Use the getconf command with the LONG_BIT option. If you are working on a 64-bit system then the output should be 64
[root@sahil-centos7 ~]# getconf LONG_BIT 64
Method6: Using lshw command
lshw is a small tool to extract detailed information on the hardware configuration of the machine, you can also identify CPU architecture using this command
To view information about CPUs on the system specify the class processor when using the lshw command as shown in the below example
[root@sahil-centos7 ~]# lshw -class processor *-cpu:0 description: CPU product: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz vendor: Intel Corp. vendor_id: GenuineIntel physical id: 4 bus info: cpu@0 version: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz slot: CPU #000 size: 2300MHz capacity: 4230MHz width: 64 bits
Notice that the width is mentioned as 64 bit indicating a 64-bit processor. Also under the capabilities section, we see the lm flag is set as we saw in the /proc/cpuinfo file.
Conclusion
In addition to the commands and tools we mentioned in this article, there are a couple of other utilities you could use to ascertain information about the system processor. But these utilities are not available in the system by default and require installation and were therefore not covered. 6 Ways To Identify CPU Architecture On Linux OS.
Related Articles
Real time Processor Utilization Shell Script
Thanks for your wonderful Support and Encouragement