Home FAQ How To Check If A Linux System Is 32 bit Or 64 Bit

How To Check If A Linux System Is 32 bit Or 64 Bit

By sk
Published: Updated: 9.1K views

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.

Update:

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

Or,

$ uname -i

Or,

$ uname -p

Sample output:

x86_64

As you see above, my Linux OS architecture is 64 bit. If you want to display all details, just use '-a' flag.

$ uname -a

Sample output:

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.

$ arch

Sample output from my machine:

x86_64

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.

file /lib/systemd/systemd

Sample output:

/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

Sample output:

/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:

$ lscpu

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

Sample output:

[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:

64

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

Sample output:

*-cpu 
 product: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
 vendor: Intel Corp.
 physical id: 2
 bus info: cpu@0
 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

Sample output:

[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

Sample output:

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.

Method 10

Finally, you can also find your OS architecture type by looking into the installed packages and libraries on your system.

$ ls -la / |grep lib

Sample output:

drwxr-xr-x 22 root root 4096 May 17 15:07 lib
drwxr-xr-x 2 root root 4096 May 17 15:10 lib64

Suggested read:


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.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

6 comments

Stephane Chauveau May 26, 2017 - 2:35 pm

Another easy way is to check at the actual size of the addresses for instance by looking in /proc/self/maps

Be aware that the addresses of the application are typically small (so within the the 32 bit boundary) so it is better to look at the address of a shared library. The stack is also a good choice because it is typically located at the far end of the available address range.

cat /proc/self/maps | grep stack
7fffeaeb4000-7fffeaed5000 rw-p 00000000 00:00 0 [stack]

In that example, we see that the stack of the ‘cat’ process starts at 0x7fffeaeb4000 which is obviously a 64 bit address (it contains more than 8 hexadecimal characters).

Remark: 0x7fffeaeb4000 is actually a 48bit address because this is the current upper limit for all addresses on the ’64bit’ Intel processors.

There is also a vsyscall entry in the maps files. That one looks like a true 64 address range but I do not know its purpose and if it is present on all Linux systems:

cat /proc/self/maps | grep vsyscall
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

Reply
SK May 27, 2017 - 4:52 pm

Thank you Stephane.

Reply
C138 June 4, 2018 - 3:52 pm

“So, this article may not useful for everyone out there”
Not really 😉
Since it’s possibe to install a 32 bits “logical” system on a 64bits “physical” architecture, it is worth saying that several commands are useful to detect your real architecture (while others are “lying”…)
Your initial statement is right : “detecting the **installed** linux OS
but this is note the same as “detecting your real architecture”.
On this point, system commands are not useful, but asking for low lewel information (/proc/cpuinfo) is the (always) right way.

Reply
Chris October 12, 2018 - 9:27 pm

Most of these will only work on intel architectures. If “uname -m” returns s390 or sparc you still don’t know 32 or 64.

Reply
WB April 4, 2019 - 3:57 am

None of this method is actually really correct.

Use this: getconf LONG_BIT

Quick and easy.

Other methods, are not portable, only tell you about the CPU capabilities or kernel, but not what you are actually running in user space, etc.

Reply
rave October 7, 2019 - 1:48 pm

Very good article, but are you sure that in /proc/cpuinfo:
– tm flag means 32bit
– rm flag means 16 bit.
I cannot find any other source confirming that and tm means rather thermal control.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More