How to determine whether the operating system is 32-bit or 64-bit

Two years ago I have described three simple ways to determine whether the processor supports 64-bit instruction set. Today, I will show you how to determine whether any Debian-based operating system is 32-bit or 64-bit.

Print machine architecture using uname command

The most obvious way to determine the answer is to execute uname command to print machine architecture.

$ uname -m

Sample output on 64-bit operating system

x86_64

Sample output on 32-bit operating system

i686

Print machine architecture using arch command

arch utility provides exactly the same information as the above (uname -m) command.

$ arch

Sample output on 64-bit operating system

x86_64

Sample output on 32-bit operating system

i686

Query system configuration variables

This is the simplest and most straightforward solution, which is often overlooked, but it is widely supported on Debian-based operating systems.

$ getconf LONG_BIT

Sample output on 64-bit operating system

64

Sample output on 32-bit operating system

32

Print architecture of packages dpkg installs

This is more indirect way to determine the answer, but an interesting one.

$ dpkg --print-architecture

Sample output on 64-bit operating system

amd64

Sample output on 32-bit operating system

i386
Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu