Linux command – yum whatprovides

Loading

有時候某一個程式沒有安裝 ,我怎麼知道他是放在哪一個套件裡的, #apt-get install command 本身就會幫忙搜尋,不用特別的方式.

  • APT

    比如我要找 #ifconfig , #apt-get 會提示你的工具是放在哪一個套件裡.

    root@benjr:~# apt-cache search ifconfig
    iproute2 - networking and traffic control tools
    net-tools - The NET-3 networking toolkit
    gnome-nettool - network information tool for GNOME
    inetutils-tools - base networking utilities (experimental package)
    libnet-ifconfig-wrapper-perl - multiplatform Perl wrapper for ifconfig
    moreutils - additional Unix utilities
    wmifinfo - Dockapp that shows information for all interfaces
    

    或是透過 apt-file 去找,會有比較多的資訊可供查詢.不過 #apt-file 非預設安裝,需要額外安裝.安裝後的第一步就是先更新資料庫.

    root@benjr:~# apt-get install apt-file
    root@benjr:~# apt-file update
    root@benjr:~# apt-file find ifconfig |grep -i /sbin/
    linux-cloud-tools-common: /usr/sbin/hv_set_ifconfig
    linux-lts-vivid-cloud-tools-common: /usr/sbin/hv_set_ifconfig
    net-tools: /sbin/ifconfig
    python-ethtool: /usr/sbin/pifconfig
    

    安裝與 #ifconfig 相關的套件 net-tools – The NET-3 networking toolkit 後,一樣可以透過 #apt-file 檢查 net-tools – The NET-3 networking toolkit 套件內容為何.

    root@benjr:~# apt-file list net-tools |grep -i ifconfig
    net-tools: /sbin/ifconfig
    net-tools: /usr/share/man/de/man8/ifconfig.8.gz
    net-tools: /usr/share/man/fr/man8/ifconfig.8.gz
    net-tools: /usr/share/man/man8/ifconfig.8.gz
    net-tools: /usr/share/man/pt_BR/man8/ifconfig.8.gz
    
  • yum

    但是 yum 就沒有提供這一項功能了,我們可以透過 #yum whatprovides

    [root@benjr ~]# yum install ifconfig
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror01.idc.hinet.net
     * extras: ftp.twaren.net
     * updates: ftp.twaren.net
    No package ifconfig available.
    Error: Nothing to do
    

    一樣是找 #ifconfig ,這結果比 #apt-get 提供的還要清楚,一看就知道是 net-tools (Filename : /sbin/ifconfig) 套件提供的.

    [root@benjr ~]# yum whatprovides "*ifconfig"
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror01.idc.hinet.net
     * extras: ftp.twaren.net
     * updates: ftp.twaren.net
    hypervkvpd-0-0.26.20150402git.el7.x86_64 : HyperV key value pair (KVP) daemon
    Repo        : base
    Matched from:
    Filename    : /usr/libexec/hypervkvpd/hv_set_ifconfig
    
    net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
    Repo        : base
    Matched from:
    Filename    : /sbin/ifconfig
    
    python-ethtool-0.8-5.el7.x86_64 : Ethernet settings python bindings
    Repo        : base
    Matched from:
    Filename    : /usr/sbin/pifconfig
    
    zsh-5.0.2-14.el7.x86_64 : Powerful interactive shell
    Repo        : base
    Matched from:
    Filename    : /usr/share/zsh/5.0.2/functions/_ifconfig
    
    zsh-5.0.2-14.el7_2.2.x86_64 : Powerful interactive shell
    Repo        : updates
    Matched from:
    Filename    : /usr/share/zsh/5.0.2/functions/_ifconfig
    
沒有解決問題,試試搜尋本站其他內容

2 thoughts on “Linux command – yum whatprovides

發佈回覆給「admin」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料