Home  >  Article  >  Operation and Maintenance  >  How to check if linux is 32-bit or 64-bit

How to check if linux is 32-bit or 64-bit

青灯夜游
青灯夜游Original
2021-12-21 18:31:5123698browse

How to check whether Linux is 32-bit or 64-bit: 1. Execute the "getconf LONG_BIT" command, the output of 32 is 32-bit, and the output of 64 is 64-bit; 2. Execute the "uname -m" command, The output of "x86_64" is 64-bit, and the output of "i686" or "i386" is 32-bit.

How to check if linux is 32-bit or 64-bit

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Check whether linux is 32-bit or 64-bit

##Method 1: getconf LONG_BIT Check

As shown in the following example: 32-bit Linux system displays 32, and 64-bit Linux system displays 64. The simplest and fastest way.

[root@DB-Server ~]# getconf LONG_BIT
32

How to check if linux is 32-bit or 64-bit

[root@gettestlnx01 ~]# getconf LONG_BIT
64

How to check if linux is 32-bit or 64-bit

Method 2: uname command to view

As shown in the following example, x86_64 Indicates a 64-bit system, i686 i386 indicates a 32-bit system. i686 is just a subset of i386. The supported CPUs start from Pentium 2 (686). Previous models are not supported.

[root@DB-Server ~]# uname -a
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

How to check if linux is 32-bit or 64-bit

[root@gettestlnx01 ~]# uname -a
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

How to check if linux is 32-bit or 64-bit

Method 3: arch command to view

[root@DB-Server ~]# arch
i686
[root@gettestlnx01 ~]# arch
x86_64

Method 4: file command to 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

How to check if linux is 32-bit or 64-bit

[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

How to check if linux is 32-bit or 64-bit

Related recommendations: "

Linux Video Tutorial"

The above is the detailed content of How to check if linux is 32-bit or 64-bit. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn