How to check Linux OS is 32 bit or 64 bit

How to check Linux OS is 32 bit or 64 bit

If we need to know our Linux OS is 32 bit or 64 bit, there are a couple of ways to check.

There are many ways on the Internet, but some ways didn't work well. We will see 3 better ways to check. This is tested on my 10+ Linux OS (CentOS, Debian, Ubuntu, ...).




Using getconf command (Recommended)

We can get system configuration value from Linux OS by using getconf command. This is recommended.

On 64 bit Linux OS, we can get the following value. 64 means 64 bit.
$ getconf LONG_BIT
64

On 32 bit Linux OS, we can get the following value. 32 means 32 bit.
$ getconf LONG_BIT
32


Using arch command (Recommended)

We can also use arch command. This is also recommended.

On 64 bit Linux OS, we can get the following result. x86_64 means 64 bit.
$ arch
x86_64

On 32 bit Linux OS, we can get the following result. i686 means 32 bit.
$ arch
i686


Using uname command

By using uname command, we can get the same information from Linux OS.

On 64 bit Linux OS, we can get the following result. x86_64 means 64 bit.
$ uname -m
x86_64

On 32 bit Linux OS, we can get the following result. i686 means 32 bit.
$ uname -m
i686