查看Linux版本
1. lsb_release -a (适用于所有linux)
LSB Version: :base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
注意:如果提示“-bash: lsb_release: command not found” ,就需要手动安装 lsb_release 命令。使用 yum install -y redhat-lsb
以下方法适用于RedHat , CentOS
#cat /etc/redhat-release
CentOS release 6.5 (Final)
CentOS release 6.5 (Final)
或者通过查看软件包名来看查看系统版本
redhat执行:
#rpm -q redhat-release
centos执行;
# rpm -q centos-release
centos-release-6-5.el6.centos.11.2.i686
centos-release-6-5.el6.centos.11.2.i686
查看linux内核版本:
1. uname -a
Linux default.hostname 2.6.32-042stab094.8 #1 SMP Tue Dec 16 20:36:56 MSK 2014 i686 i686 i386 GNU/Linux
或者直接用-r 参数
uname -r
2.6.32-042stab094.8
2.6.32-042stab094.8
2. cat /proc/version
Linux version 2.6.32-042stab094.8 (root@kbuild-rh6-x64) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Tue Dec 16 20:36:56 MSK 2014
查看系统位数(查看机器字长)
1..直接看看有没有/lib64 目录。64位的系统会有/lib64和/lib两个目录,32位只有/lib一个
#cd / | ls
2.getconf LONG_BIT
32
3.file /bin/ls 查看基本程序二进制信息
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
注意:如果没有file 这个命令,就使用 yum install file 安装这个file命令。
查看系统详细参数信息
getconf -a