當前位置:
首頁 > 知識 > 查看linux版本及lsb release安裝及一些想法

查看linux版本及lsb release安裝及一些想法

先說查看linux 內核方法

一:cat /proc/version

[python] view plain copy

  1. <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># cat /proc/version
  2. 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

  1. <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># uname -a
  2. 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

  1. <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># lsb_release -a
  2. LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
  3. Distributor ID: CentOS
  4. Description: CentOS release 6.4 (Final)
  5. Release: 6.4
  6. Codename: Final</span>

二:cat /etc/redhat-release (此方法只適合Redhat系的Linux)

[python] view plain copy

  1. <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># cat /etc/redhat-release
  2. CentOS release 6.4 (Final)
  3. You have new mail

    in

    /var/spool/mail/root</span>

三:cat /etc/issue (此命令適用於所有的Linux發行版本)

[python] view plain copy

  1. <span stylex="font-family:"KaiTi_GB2312";font-size:18px;"># cat /etc/issue
  2. CentOS release 6.4 (Final)
  3. Kernel
    on an m</span>

然後再說安裝lsb_release的過程吧在沒有此命令的時候,執行會報命令不存在,咋辦呢?一個方法:yum provides */lsb_release

當前命令的好處就是幫你找到哪裡可以下載到這個lsb_release命令的地方

[python] view plain copy

  1. # yum provides */lsb_release
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds

    from

    cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.btte.net
  6. * updates: mirrors.aliyun.com
  7. base/filelists_db | 6.4 MB 00:07
  8. extras/filelists_db | 38 kB 00:00
  9. updates/filelists_db | 3.5 MB 00:04
  10. zabbix/filelists | 65 kB 00:00
  11. zabbix-non-supported/filelists | 3.0 kB 00:00
  12. redhat-lsb-core-4.0-7.el6.centos.i686 : LSB base libraries support

    for

    CentOS
  13. Repo : base
  14. Matched

    from

    :

  15. Filename : /usr/bin/lsb_release
  16. redhat-lsb-core-4.0-7.el6.centos.x86_64 : LSB base libraries support

    for

    CentOS
  17. Repo : base
  18. Matched

    from

    :
  19. 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

  1. yum install redhat-lsb-core-4.0-7.el6.centos.x86_64

之後就是一堆執行過程,大致截圖如下

查看linux版本及lsb release安裝及一些想法

等到執行完畢我們驗證一下。ok,已成功安裝。

然後由安裝這個lsb_release命令,新學到了一個方法,就是上面黃底標紅的文字yum provides */。

意思就是通過目標命令名稱,查找這個命令所屬的安裝包,比如本文我就是執行的yum provides */lsb_release

以後如果不知道某個命令從哪兒安裝,可以考慮使用這個命令來查找。

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 程序員小新人學習 的精彩文章:

Python爬蟲之基本原理
Discuz全版本任意文件刪除漏洞

TAG:程序員小新人學習 |