Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

How to know if your CPU is 32 or 64 bits in GNU/Linux

Leer en espanol
How to know if your CPU is 32 or 64 bits in GNU/Linux

Table of contents

We can see all the processor data in the file /proc/cpuinfo ===

When installing any type of GNU/Linux distribution we have to know if our processor is 32 Bit or 64 Bit.

We can see all the processor data in the /proc/cpuinfo file.

We execute the following command:

BASH
Bash
grep flags /proc/cpuinfo

If the result appears lm, then it supports 64 bit; if it appears Protected Mode, supports 32 bit; if it appears Real Mode, supports 16 bit.

We can also use the following scripts:

BASH
php
#!/bin/bash
#####################################################################################
#####################################################################################
####################################################################################
########################         Script Comprobación Procesador          ###########
########################   rokitoh - www.red-orbita.com                  ###########
########################                                                 ###########
####################################################################################
####################################################################################
####################################################################################

grep -q lm /proc/cpuinfo > /dev/null
if [ $? -eq 0 ]
then

echo "CPU de 64 bits (soporta x86_64)"

else

echo "CPU de 32 bits (no soporta x86_64)"

fi

You can also run the following script in one line:

BASH
php
grep -q "^flags.*\blm\b" /proc/cpuinfo && echo "CPU de 64 bits (soporta x86_64)" || echo "CPU de 32 bits (no soporta x86_64)"

Comments