方法一:
32位的系统中int类型和long类型一般都是4字节;
64位的系统中int类型还是4字节的,但是long已变成了8字节;
linux系统中可 用"getconf WORD_BIT"和"getconf LONG_BIT"获得word和long的位数;
64位系统中应该分别得到32和64;
[root@bogon ~]# getconf LONG_BIT
64
方法二:
[root@root ~]# ls /
backup dev ftp lib lost+found misc opt selinux sysupgrade var
bin etc ftpsite lib64 media mnt proc sip.conf tmp
#如果有lib64或这个目录,那操作系统就是64位的;
方法三:
32位:
[root@localhost ~]# ldd /sbin/mii-tool
linux-gate.so.1 => (0x0054d000)
libselinux.so.1 => /lib/libselinux.so.1 (0x00149000)
libc.so.6 => /lib/libc.so.6 (0x00b23000)
libdl.so.2 => /lib/libdl.so.2 (0x00c94000)
libsepol.so.1 => /lib/libsepol.so.1 (0x00101000)
64位:
[root@localhost~]# ldd /sbin/mii-tool
libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003855600000)
libc.so.6 => /lib64/libc.so.6 (0x000000384f200000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000384f600000)
libsepol.so.1 => /lib64/libsepol.so.1 (0x0000003855200000)
/lib64/ld-linux-x86-64.so.2 (0x000000384ee00000)
/lib/ld-linux.so.2 (0x00b00000)