We already knew how to check if a Linux system is physical or virtual machine. Now, it is time to find out if the installed Linux OS is either 32 bit or 64 bit. If your Linux system has GUI, it is really easy. Just navigate to System Settings -> Details, and there you go, you will know the architecture. In CLI based Linux systems, it is bit different. This guide will explain how to check if a Linux system is 32 bit or 64 bit. It is not that difficult. Read on.
Most Linux OS versions have ditched 32 bit support. So, this article may not useful for everyone out there. If you still have a good old hardware that supports 32 bit OS, this article will definitely be helpful.
Check If A Linux System Is 32 bit Or 64 Bit
There might be many ways to find out the architecture of your system. These are only the methods I am aware of now. I will keep update this guide if I find any other ways to do this. Bookmark this page, and keep visiting.
Method 1 - Using uname command
My preferred way to find out a Linux system's architecture is using uname command. The uname is part of GNU coreutils that displays certain system information, such as hostname, Kernel version, Kernel release, OS version, and system's architecture etc.
To find if your Linux system is 32 bit or 64 bit, just run the following command from the Terminal:
$ uname -m
$ uname -i
$ uname -p
As you see above, my Linux OS architecture is 64 bit. If you want to display all details, just use '-a' flag.
$ uname -a
Linux sk 4.16.11-1-ARCH #1 SMP PREEMPT Tue May 22 21:40:27 UTC 2018 x86_64 GNU/Linux
This command not just displays the architecture, but all other details, such as Kernel name, version, system name etc.
Method 2 - Using arch command
Yet another way to find out the system's architecture is to use arch command. The arch command is same as 'uname -m' command which displays the machine hardware name.
Sample output from my machine:
Method 3 - Using file command
You can also check your Linux system's architecture using file command.
$ file /sbin/init
Or, use the following command on systems that use systemd.
/lib/systemd/systemd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=8d3cb750275dc2f474dc7f049fdffb3a649b1d49, stripped, with debug_info
Also, you can use the following command to check your system's architecture:
$ file /usr/bin/id
/usr/bin/id: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ca513ae4d630324b1eadcd78122490248a27b8b6, stripped
Method 4 - Using lscpu command
The lscpu command is part of the util-linux package that displays the information about the CPU architecture.
To find if your Linux system is 32 bit or 64 bit, just run:
Sample output would be:
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 42 Model name: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz Stepping: 7 CPU MHz: 799.890 CPU max MHz: 2300.0000 CPU min MHz: 800.0000 BogoMIPS: 4591.21 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0-3 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm epb tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts
Method 5 - Using dpkg command
The dpkg is a package manager that can be used to to install, build, remove and manage Debian packages. We can tell if our system OS is either 32 bit or 64 bit as shown below.
$ dpkg --print-architecture
[For 64 bit OS] amd64 [For 32 bit OS] i386
This method will work only on Debian and other APT based systems such as Ubuntu, Linux Mint.
Method 6 - Using getconf utility
We can find our system's architecture using getconf utility. It displays your system's configuration variables and their values.
To find if the installed OS is 32 or 64 bit, just run:
$ tconf LONG_BIT
Sample output would be:
Method 7 - Using lshw utility
The lshw utility can also be used to discover whether your Linux is 32 bit or 64 bit. It will display detailed information on the hardware configuration of a Linux system.
To display whether your Linux OS is either 32 or 64 bit, just run:
$ sudo lshw -c cpu
*-cpu product: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz vendor: Intel Corp. physical id: 2 bus info: [email protected] width: 64 bits capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp x86-64 constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt xsave avx hypervisor lahf_lm
Or, you can be more specific:
$ sudo lshw -c cpu | grep width
Method 8 - Using HOSTTYPE environment variable
The another way to find out your system's OS architecture is using HOSTTYPE environment variable like below.
$ echo $HOSTTYPE
[64 bit system] x86_64 [32 bit system] i386
Method 9 - Using /proc/cpuinfo
We can find our system's OS architecture from /proc/cpuinfo file.
$ sudo grep flags /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt xsave avx hypervisor lahf_lm
- lm flag means 64-bit (Long mode cpu)
- tm flag means 32-bit (Protected mode)
- rm flag means 16-bit CPU (Real Mode)
As you see in the output, I use 64 bit.
Finally, you can also find your OS architecture type by looking into the installed packages and libraries on your system.
$ ls -la / |grep lib
drwxr-xr-x 22 root root 4096 May 17 15:07 lib drwxr-xr-x 2 root root 4096 May 17 15:10 lib64
And, that's all for now. I hope this helps. If you find our guides useful, please share them on your social, professional networks and support OSTechNix.