查看linux版本及lsb release安裝及一些想法
先說查看linux 內核方法
一:cat /proc/version
[python] view plain copy
- <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># cat /proc/version
- Linux version 2.6.32-358.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Fri Feb 22 00:31:26 UTC 2013</span>
二:uname -a[python] view plain copy
- <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># uname -a
- Linux mall-giftserver 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux</span>
再說查看linux 系統版本的方法一:lsb_release -a (此命令適用於所有的Linux發行版本)
[python] view plain copy
- <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># lsb_release -a
- LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
- Distributor ID: CentOS
- Description: CentOS release 6.4 (Final)
- Release: 6.4
- Codename: Final</span>
二:cat /etc/redhat-release (此方法只適合Redhat系的Linux)
[python] view plain copy
- <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># cat /etc/redhat-release
- CentOS release 6.4 (Final)
- You have new mail
in
/var/spool/mail/root</span>
三:cat /etc/issue (此命令適用於所有的Linux發行版本)
[python] view plain copy
- <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># cat /etc/issue
- CentOS release 6.4 (Final)
- Kernel
on an m</span>
然後再說安裝lsb_release的過程吧在沒有此命令的時候,執行會報命令不存在,咋辦呢?一個方法:yum provides */lsb_release
當前命令的好處就是幫你找到哪裡可以下載到這個lsb_release命令的地方
[python] view plain copy
- # yum provides */lsb_release
- Loaded plugins: fastestmirror
- Loading mirror speeds
from
cached hostfile - * base: mirrors.aliyun.com
- * extras: mirrors.btte.net
- * updates: mirrors.aliyun.com
- base/filelists_db | 6.4 MB 00:07
- extras/filelists_db | 38 kB 00:00
- updates/filelists_db | 3.5 MB 00:04
- zabbix/filelists | 65 kB 00:00
- zabbix-non-supported/filelists | 3.0 kB 00:00
- redhat-lsb-core-4.0-7.el6.centos.i686 : LSB base libraries support
for
CentOS - Repo : base
- Matched
from
:
- Filename : /usr/bin/lsb_release
- redhat-lsb-core-4.0-7.el6.centos.x86_64 : LSB base libraries support
for
CentOS - Repo : base
- Matched
from
: - Filename : /usr/bin/lsb_release
如上所示,應該告訴我們在redhat-lsb-core-4.0-7.el6.centos.i686和redhat-lsb-core-4.0-7.el6.centos.x86_64這兩處可以找到,我用的是後一個包中。於是按照下面方法執行
[python] view plain copy
- yum install redhat-lsb-core-4.0-7.el6.centos.x86_64
之後就是一堆執行過程,大致截圖如下
等到執行完畢我們驗證一下。ok,已成功安裝。
然後由安裝這個lsb_release命令,新學到了一個方法,就是上面黃底標紅的文字yum provides */。
意思就是通過目標命令名稱,查找這個命令所屬的安裝包,比如本文我就是執行的yum provides */lsb_release
以後如果不知道某個命令從哪兒安裝,可以考慮使用這個命令來查找。
※Python爬蟲之基本原理
※Discuz全版本任意文件刪除漏洞
TAG:程序員小新人學習 |