Summary of how to check whether the system is 32-bit or 64-bit in Linux

Source: Internet
Author: User

This blog summarizes and summarizes some methods to check whether the Linux system is 32-bit or 64-bit. A lot of content comes from the blogs of online users. This article only sorts out and sorts out this knowledge so that you can view it whenever you forget it.

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

References:

Http://www.cnblogs.com/dingchenghong/archive/2012/06/29/2569456.html

Http://blog.csdn.net/tianlesoftware/article/details/6267115

Http://www.cnblogs.com/JemBai/archive/2012/05/25/2517783.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.