Method One: getconf long_bit
Enter the getconf long_bit command on the Linux terminal
If it is a 32-bit machine, the result is 32
- [Email protected] ~]# getconf long_bit
- 32
If it is a 64-bit machine, the result is 64
- [Email protected] ~]# getconf long_bit
- 64
Method Two: Uname-a
If it is a 64-bit machine, it will output x86_64
- [Email protected] ~]$ uname-a
- Linux testweb01 2.6. 18-308.4. 1.el5 #1 SMP Tue Apr :£ ºEDT x86_64 x86_64 x86_64 gnu/linux
As you can see, the output of x86_64 in the results of the uname-a execution indicates that the machine is 64-bit, otherwise the machine is 32-bit
- [Email protected] ~]# uname-a
- Linux localhost.localdomain 2.6. 18-164.el5 #1 SMP Tue ::EDT i686 i686 i386 gnu/linux /c5>
Method Three: File/sbin/init or File/bin/ls
Example: 32-bit machine
File/sbin/init
- [Email protected] ~]# File/sbin/init
- /sbin/init:elf 32-bit LSB executable, Intel 80386, version 1 (SYSV), for Gnu/linux 2.6. 9, dynamically linked (uses shared libs), for Gnu/linux 2.6. 9, stripped
File/bin/ls
- [Email protected] ~]# File/bin/ls
- /bin/ls:elf 32-bit LSB executable, Intel 80386, version 1 (SYSV), for Gnu/linux 2.6. 9, dynamically linked (uses shared libs), for Gnu/linux 2.6. 9, stripped
Example: 64-bit machine
File/sbin/init
- [Email protected] ~]$ File/sbin/init
- /sbin/init:elf 64-bit LSB executable, AMD x86-, version 1 (SYSV), for Gnu/linux 2.6. 9, dynamically linked (uses shared libs), for Gnu/linux 2.6. 9, stripped
File/bin/ls
- [Email protected] ~]$ File/bin/ls
- /bin/ls:elf 64-bit LSB executable, AMD x86-, version 1 (SYSV), for Gnu/linux 2.6. 9, dynamically linked (uses shared libs), for Gnu/linux 2.6. 9, stripped
The 64-bit or 32-bit in the command result can be used to determine whether the machine is 64-bit or 32-bit.
How to Tell if Linux is 32-bit or 64-bit