How do I know if my Linux is 32 bit or 64 bit?

I need to find out if my Linux server is running on 32-bit or 64-bit system. How do I know if my Linux is 32 bit or 64 bit?

To check if your Linux server runs a 32 bit or 64-bit system, try the following Linux commands. Open the terminal application and then know whether your system is 32-bit or 64-bit, type the commands and press the [Enter] key as per your requirements:

  1. Get ALL information about CPU on Linux, Execute: lscpu or cat /proc/cpuinfo
  2. Is my running Linux kernel 32 bit or 64 bit? Run: getconf LONG_BIT
  3. Is my CPU is in 32 bit or 64 bit mode? Run: grep -o -w 'lm' /proc/cpuinfo | sort -u

Let us see all commands to Find if Linux is running on 32-bit or 64-bit systems.

How do I know if my Linux is 32 bit or 64 bit?

To know information about the CPU architecture, type the following lscpu command:
lscpu

From the above output it is clear that I have:

  • CPU: AMD Ryzen 7 1700 Eight-Core Processor
  • Architecture: x86_64
  • CPU can run: 32bit or 64-bit operating system

Find out CPU is 32bit or 64bit on a Linux system

Simply run the following grep command:
grep -o -w 'lm' /proc/cpuinfo | sort -u
Sample outputs:

lm

The lm flag means long mode cpu i.e. 64 bit CPU. For more info type the following cat command to get complete info on your CPU:
cat /proc/cpuinfo
cat /proc/cpuinfo | more

How do I know if my Linux is 32 bit or 64 bit?

Now you know you have an AMD CPU that can run both 32bit and 64 bit operating systems. But, how do I know if my current kernel and Linux distro are 64-bit or 32-bit? Fear not, run the following command:
getconf LONG_BIT

64

The getconf command checks if the Linux kernel is 32 bit or 64 bit. The 64 means I am running 64 bit Linux kernel and Linux distro.

Other Linux command to check if I have a 32-bit or a 64-bit OS

Run the following uname command:
uname -i
For 64bit you will get x86_64 and i386 for 32bit Intel CPU.

A note about GUI method

Open your Linux distros, System Settings window, and select the Details:

Use the lshw command

Execute the following lshw command to list all info about CPU:
sudo lshw -c cpu
Sample outputs:

  *-cpu                     
       description: CPU
       product: AMD Ryzen 7 1700 Eight-Core Processor
       vendor: Advanced Micro Devices [AMD]
       physical id: f
       bus info: cpu@0
       version: AMD Ryzen 7 1700 Eight-Core Processor
       serial: Unknown
       slot: AM4
       size: 1302MHz
       capacity: 3750MHz
       width: 64 bits
       clock: 100MHz
       capabilities: x86-64 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 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca cpufreq
       configuration: cores=8 enabledcores=8 threads=16

Check if your Linux system is 32-bit or 64-bit

Here is a sample shell script to putting it all together:

#!/bin/bash
# Author - Vivek Gite, under GPL v2.0+
# Purpose - Quick and dirty way to get info about Linux kernel and CPU bits
# ----------------------------------------------------------------------------
BIT=$(getconf LONG_BIT)
CPU=$(grep -o -w 'lm' /proc/cpuinfo | sort -u)
VER="$(uname -mrs)"
echo "* Linux kernel - $BIT bit"
echo "* Linux kernel version - $VER"
[[ $CPU == "lm" ]] && echo "* CPU - 64 bit"
echo "*** CPU details *** "
lscpu | egrep 'Architecture|CPU|Thread|Core'

Sample outputs:

* Linux kernel - 64 bit
* Linux kernel version - Linux 5.4.0-45-generic x86_64
* CPU - 64 bit
*** CPU details *** 
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
CPU(s):                          12
On-line CPU(s) list:             0-11
Thread(s) per core:              2
Core(s) per socket:              6
CPU family:                      6
Model name:                      Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
CPU MHz:                         1000.614
CPU max MHz:                     4600.0000
CPU min MHz:                     800.0000
NUMA node0 CPU(s):               0-11

Conclusion

You learned that most Intel-based servers and the computer could run both 32-bit and 64-bit operating system. Further you learned the various command line option to determine whether you are running a 32-bit or 64-bit version of Linux kernel and operating systems.

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.