How to determine whether a given Linux is 32 bit or 64 bit?
To determine whether your Linux system is 32-bit or 64-bit, you can use any of the following commands:
-
Check Kernel Architecture via
uname
uname -m
x86_64
indicates a 64-bit kernel on x86 architecture.i686
ori386
typically means a 32-bit kernel on x86.- On ARM systems, 64-bit could appear as
aarch64
, whereas 32-bit might bearmv7l
, etc.
-
Check Full System Details via
uname -a
uname -a
This shows more information (like kernel version), and you can look for
x86_64
(or another 64-bit indicator) to confirm. -
Using
file /sbin/init
file /sbin/init
This examines the
/sbin/init
binary and reports whether it’s 32-bit or 64-bit. For example:ELF 64-bit LSB executable
=> a 64-bit userland.ELF 32-bit LSB executable
=> a 32-bit userland.
-
Using
lscpu
lscpu
- Look at the “Architecture” or “CPU op-mode(s)” lines:
CPU op-mode(s): 32-bit, 64-bit
=> 64-bit CPU that can run either mode.CPU op-mode(s): 32-bit
=> purely 32-bit environment.
- Look at the “Architecture” or “CPU op-mode(s)” lines:
-
Distribution-Specific Tools
- Some distributions have graphical tools or system information commands (e.g.
inxi -S
) that indicate whether the installed OS is 32-bit or 64-bit.
- Some distributions have graphical tools or system information commands (e.g.
Recommended Resource
If you want to sharpen your coding skills along with your system knowledge, consider this course from DesignGurus.io:
- Grokking Data Structures & Algorithms for Coding Interviews
Solidifying your understanding of data structures and algorithms helps you create efficient solutions, whether you’re writing scripts for 32-bit or 64-bit systems or tackling complex engineering problems.
CONTRIBUTOR
TechGrind