linux oracle 网络安全 编程
分类: linux
2013-01-05 17:01:29
一。查看内核版本命令:
1) [root@sor_sys ~]# cat /proc/version
linux version 2.6.18-238.el5 () (gcc version 4.1.2 20080704 (red hat 4.1.2-50)) #1 smp sun dec 19 14:22:44 est 2010
[root@sor_sys ~]#
2)[root@sor_sys ~]# uname -r
2.6.18-238.el5
3)[root@sor_sys ~]# uname -a
linux sor_sys.99bill.com 2.6.18-238.el5 #1 smp sun dec 19 14:22:44 est 2010 x86_64 x86_64 x86_64 gnu/linux
[root@sor_sys ~]#
二。查看linux版本:
1) 登录到服务器执行 lsb_release -a ,即可列出所有版本信息,例如:
[root@sor_sys ~]# lsb_release -a
lsb version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
distributor id: redhatenterpriseas
description: red hat enterprise linux as release 4 (nahant update 4)
release: 4
codename: nahantupdate4
[root@sor_sys ~]#
注:这个命令适用于所有的linux,包括redhat、suse、debian等发行版。
2) 登录到linux执行cat /etc/issue,例如如下:
[root@sor_sys ~]# cat /etc/issue
red hat enterprise linux server release 5.6 (tikanga)
kernel \r on an \m
[root@sor_sys ~]#
3) 登录到linux执行cat /etc/redhat-release ,例如如下:
[root@sor_sys ~]# cat /etc/redhat-release
red hat enterprise linux as release 4 (nahant update 4)
[root@sor_sys ~]#
注:这种方式下可以直接看到具体的版本号,比如 as4 update 1
4)登录到linux执行rpm -q redhat-release ,例如如下:
[root@sor_sys ~]# rpm -q redhat-release
redhat-release-5server-5.6.0.3
[root@sor_sys ~]#
注:这种方式下可看到一个所谓的release号,比如上边的例子是5
这个release号和实际的版本之间存在一定的对应关系,如下:
redhat-release-3as-1 -> redhat enterprise linux as 3
redhat-release-3as-7.4 -> redhat enterprise linux as 3 update 4
redhat-release-4as-2 -> redhat enterprise linux as 4
redhat-release-4as-2.4 -> redhat enterprise linux as 4 update 1
redhat-release-4as-3 -> redhat enterprise linux as 4 update 2
redhat-release-4as-4.1 -> redhat enterprise linux as 4 update 3
redhat-release-4as-5.5 -> redhat enterprise linux as 4 update 4
另:第3)、4)两种方法只对redhat linux有效
5) [root@sor_sys ~]# file /bin/bash
/bin/bash: elf 64-bit lsb executable, amd x86-64, version 1 (sysv), for gnu/linux 2.6.9, dynamically linked (uses shared libs), for gnu/linux 2.6.9, stripped
[root@sor_sys ~]#
6) [root@sor_sys ~]# file /bin/cat
/bin/cat: elf 64-bit lsb executable, amd x86-64, version 1 (sysv), for gnu/linux 2.6.9, dynamically linked (uses shared libs), for gnu/linux 2.6.9, stripped
[root@sor_sys ~]#