Home >Operation and Maintenance >Linux Operation and Maintenance >How to determine whether the system is 64-bit in Linux

How to determine whether the system is 64-bit in Linux

青灯夜游
青灯夜游Original
2023-02-16 11:52:464240browse

Judgment method: 1. Use the uname command, syntax "uname -a" or "uname -m", the output "x86_64" is 64-bit; 2. Use the arch command, directly execute "arch" ; 3. Execute the "getconf LONG_BIT" command and the output is "64"; 4. Use the file command with the syntax "file /sbin/init" or "file /bin/ls". If the output information contains x86_64, it means 64-bit.

How to determine whether the system is 64-bit in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to determine whether the system is 64-bit in Linux

Method 1: Use the uname command

uname can display information about the computer and operating system.

As shown in the following example, x86_64 represents a 64-bit system.

[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 determine whether the system is 64-bit in Linux

  • -a or --all : Display all information.

  • -m or --machine: Display the computer type.

Method 2: Using the arch command

The arch command is mainly used to display the hardware structure type of the current host. The results output by the arch command are: i386, i486, mips, alpha, etc. Where x86_64 represents a 64-bit system.

[root@DB-Server ~]# arch
i686

[root@gettestlnx01 ~]# arch
x86_64

Method 3: Use the getconf LONG_BIT command

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

[root@gettestlnx01 ~]# getconf LONG_BIT
64

How to determine whether the system is 64-bit in Linux

How to determine whether the system is 64-bit in Linux

Method 4: Use the file command

Linux file command is used to identify files type.

[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 ~]# 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 determine whether the system is 64-bit in Linux

The output information contains x86_64 to indicate a 64-bit system.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to determine whether the system is 64-bit in Linux. 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