Linux: Check CPU for 64-bit Support

To check for a 64-bit capable CPU on a x86 system running on Linux, we can make use the /proc/cpuinfo file. Note that this will not determine if the OS is 64-bit or not. It will only determine if the CPU is capable of running a 64-bit OS. To check if the Linux OS is running 32-bit or 64-bit, you can refer to this article instead.

To check for 64-bit capability, we will need to check for the presence of the lm (Long Mode) flag. In the x86-64 computer architecture, long mode is the mode where a 64-bit OS can access 64-bit instructions and registers.

If 64-bit is supported, you will get an output of 0 from the following command.

If lm flag is not found under the CPU flags, then the CPU will not support 64-bit mode and you will get an output of 1 from the following command.

Note that you can still run a 32-bit OS on a 64-bit capable CPU. But a 64-bit OS can only be run on a CPU that has 64-bit support.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }