If you're a Linux newbie, you should know that there will be times - such as when installing packages - when you'll be looking for a way to see if your operating system is 32-bit or 64-bit.
The information is not hard to find, but there is more than one way to access it. In this tutorial, I'll discuss some of those ways. But before we start the discussion, it's worth sharing that all the instructions and commands mentioned in this article have been tested on Ubuntu 20.04 LTS and Debian 10, and CentOS 8
How to check if your Linux system is 64-bit or 32-bit
1. Using the uname command
Uname is a command-line utility that prints system information. You can use the command with -i option to produce the required information:
If the aforementioned command produces i686 in output, then your OS is 32-bit. If the output is x86_64, then the OS is 64-bit. For example, my system is 64-bit:
2. Using the getconf command
The getconf command is basically used to query system configuration variables. To check whether your OS is 32-bit or 64-bit, run getconf in the following way:
If the output is 32, then your OS is 32-bit, and if the output is 64, then the OS is 64-bit.
3. Using the file command
The file command is usually used to determine the file type. However, you can also use this tool to determine whether the OS is 32-bit or 64-bit. Here's how it's done:
For systems using init, run the following command:
And for systems using systemd (like Ubuntu 16.04), run the following command:
The output of these commands should contain "32-bit" for 32-bit systems and "64-bit" for 64-bit OS.
For example, here's the output in my case:
/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=c394677bccc720a3bb4f4c42a48e008ff33e39b1, stripped
The highlighted text suggests my system is 32-bit.
4. Using the dpkg command
If you are using Debian or Debian-based system like Ubuntu, you can also use the dpkg package managing tool to check for 32-bit or 64-bit OS. Here's the exact command:
The aforementioned command should display something like 'i386' in output if the OS is 32-bit, and something like 'amd64' if the OS is 64-bit. For example, the following screenshot shows the output in my case:
5. Heading to system settings
If you are on Ubuntu Desktop, you can also find the information by heading to System Settings... -> Details.