linux centos小技巧之查看CentOS版本信息

发表于:
来源:阿酷技术学习
作者:simplefastbest

工作中,我们经常需要查看Centos的版本信息。

通过/etc/issue查看

less /etc/issue
CentOS release 6.5 (Final)

通过/etc/redhat-release查看

less /etc/redhat-release
CentOS release 6.5 (Final)

通过/proc/version查看

less /proc/version
Linux version 2.6.32-431.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013

通过uname -a 查看

uname -a
Linux yueliang 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

通过以上方法,我们能知道系统是64位得。而且我们还可以用以下方法也可以知道。

判定64位系统还是32位系统?

getconf LONG_BIT 
64
//32位系统中int 和long都是4个字节,64位系统中int是4个字节,但long是8个字节
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 executable,可以看出该系统为64 bit