目录
查看centos版本
cat /etc/issue
[root@localhost ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
cat /etc/redhat-release
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
查看linux版本
cat /proc/version
[root@localhost ~]# cat /proc/version
Linux version 2.6.32-754.15.3.el6.x86_64 (mockbuild@x86-01.bsys.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) ) #1 SMP Tue Jun 18 16:25:32 UTC 2019
uname -a
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-754.15.3.el6.x86_64 #1 SMP Tue Jun 18 16:25:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
uname -r
[root@localhost ~]# uname -r
2.6.32-754.15.3.el6.x86_64
查看系统是32位或者64位
32位的系统中int类型和long类型一般都是4字节,64位的系统中int类型还是4字节的,但是long已变成了8字节。
linux系统中可用”getconf WORD_BIT”和”getconf LONG_BIT”获得word和long的位数。
64位系统中应该分别得到32和64。
getconf LONG_BIT
[root@localhost ~]# getconf LONG_BIT
64
getconf WORD_BIT
[root@localhost ~]# getconf WORD_BIT
32
file /bin/ls
[root@localhost ~]# 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
可以看到 ELF 64-bit LSB 所以该系统为64位