Summary of the Linux system's 32-bit or 64-bit viewing method, linux32-bit
[Statement]
The copyright of this article is owned by the original author. You are welcome to repost it.
Original Author: Xiaoxiang hermit
Source: http://www.cnblogs.com/kerrycode/
Original article:
Https://www.cnblogs.com/kerrycode/p/3785768.html
Whether the Linux system is 32-bit or 64-bitViewMethod Summary
Method 1:Getconf LONG_BIT View
For example, 32-bit Linux and 64-bit Linux are displayed. The simplest and quickest method.
[Root @ DB-Server ~] # Getconf LONG_BIT
32
[Root @ gettestlnx01 ~] # Getconf LONG_BIT
64
Method 2:Uname command View
As shown in the following example, x86_64 indicates a 64-bit system, and i686 i386 indicates a 32-bit system. I686 is only a subset of i386, and the supported cpu starts from Pentium 2 (686), which is not supported by the previous model.
[Root @ DB-Server ~] # Uname-
Linux DB-Server 2.6.18-194. el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[Root @ DB-Server ~] # Uname-m
I686
[Root @ gettestlnx01 ~] # Uname-
Linux gettestlnx01 3.8.13-16.2.1.el6uek.x86 _ 64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[Root @ gettestlnx01 ~] # Uname-m
X86_64
Method 3:Arch command View
[Root @ DB-Server ~] # Arch
I686
[Root @ gettestlnx01 ~] # Arch
X86_64
Method 4:File command View
[Root @ DB-Server ~] # 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
[Root @ DB-Server ~] #
[Root @ DB-Server ~] #
[Root @ DB-Server ~] # 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
[Root @ gettestlnx01 ~] # File/sbin/init
/Sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
[Root @ gettestlnx01 ~] #
[Root @ gettestlnx01 ~] #
[Root @ gettestlnx01 ~] # File/bin/ls
/Bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
Method 5:This method comes from David's blog and checks CPU information to determine whether the Linux system is a 64-bit operating system. If the result is greater than 0, 64bit computing is supported. lm indicates long mode, and lm indicates 64bit.
[Root @ DB-Server ~] # Cat/proc/cpuinfo | grep flags | grep 'lm '| wc-l
0
[Root @ gettestlnx01 ~] # Cat/proc/cpuinfo | grep flags | grep 'lm '| wc-l
6