最近在部署was时,发现有些命令不能使用,查资料发现不同linux发行版本,部分命令有差异。在部署软件之前要充分了解linux的版本信息,查询版本信息主要有以下几个命令:
1.uname,uname-r,uname -a,cat /proc/version 查看系统的内核版本,命令适用于aix,hp_ux等系统;
[[email protected] etc]# uname
Linux
[[email protected] etc]# uname -r
2.6.32-220.el6.x86_64
[[email protected] etc]# uname -a
Linux LSZDDB1 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] etc]#
[[email protected] etc]# cat /proc/version
Linux version 2.6.32-220.el6.x86_64 ([email protected]) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Tue Dec 6 19:48:22 GMT 2011
2.cat /etc/issue ,cat /etc/centos-release 查看系统的发行版本
[[email protected] etc]# cat /etc/issue
CentOS release 6.2 (Final)
Kernel \r on an \m
[[email protected] etc]# cat /etc/centos-release
CentOS release 6.2 (Final)
[[email protected] etc]#
4.lsb_release -a 查看系统发行版本的所有信息
[[email protected] etc]# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.2 (Final)
Release: 6.2
Codename: Final
[[email protected] etc]#
总结:要查看操作系统是否是linux 用uname,
要查看内核版本 uname-a
要查看linux系统的发行版本用 cat /etc/issue
要查看发行版本的所有信息用 lsb_release -a
linux学习笔记一:linux版本查询