判断Linux/Unix为32位或64位

判断Linux/Unix为32位或64位

方法一:

$uname -m

x86_64 (64位)

i686 (32位)


方法二:

$getconf LONG_BIT

32 (32位)

64 (64位)


方法三:

$ file /sbin/init

/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x5f722891935c0f35fd8f318d4606b334a9b1d423, stripped

/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

/sbin/init: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped


你可能感兴趣的:(64位,32位,linux/unix)