如何查看yum已安裝的包

簡(jiǎn)介

yum是Centos自帶的交互式包管理工具。它能夠安裝、刪除、更新指定的包,智能分析并處理包依賴,也能夠查詢可安裝的及已經(jīng)安裝的包。

命令格式

yum [options] [command] [package ...]

常用選項(xiàng)

  • -h, --help
    顯示幫助信息

  • -y, --assumeyes
    所有提問按yes執(zhí)行,可以免去很多手動(dòng)輸入的煩惱

常用命令

  • yum install
    會(huì)安裝最新版本的包并自動(dòng)解決包依賴問題。

  • yum list
    yum list命令提供了一些選項(xiàng),常用選項(xiàng)如下:

    • yum list all
      列出所有可用和已安裝的包。

    • yum list available
      列出所有可安裝的包。

    • yum list updates
      列出所有可更新的包。

    • yum list installed
      可以直接使用,后面也可以跟包名,不跟包名時(shí)會(huì)列出所有已安裝的包。
      yum list installedyum list installed git、yum list installed geo*

示例如下:

[test@localhost ~]$ yum list installed
已加載插件:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
 * base: mirrors.huaweicloud.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
已安裝的軟件包
GeoIP.x86_64                                                         1.5.0-11.el7                                                    @anaconda
NetworkManager.x86_64                                                1:1.8.0-9.el7                                                   @anaconda
NetworkManager-libnm.x86_64                                          1:1.8.0-9.el7                                                   @anaconda
NetworkManager-team.x86_64                                           1:1.8.0-9.el7                                                   @anaconda
NetworkManager-tui.x86_64                                            1:1.8.0-9.el7                                                   @anaconda
NetworkManager-wifi.x86_64                                           1:1.8.0-9.el7                                                   @anaconda
acl.x86_64                                                           2.2.51-12.el7                                                   @anaconda
[test@localhost ~]$ yum list installed git
已加載插件:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
已安裝的軟件包
git.x86_64                                                          1.8.3.1-21.el7_7                                                           @updates
[test@localhost ~]$ yum list installed git
[hackdata@localhost ~]$ yum list installed geo*
已加載插件:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
已安裝的軟件包
GeoIP.x86_64                                                           1.5.0-11.el7                                                           @anaconda
  • yum search
    按相關(guān)信息模糊查找對(duì)應(yīng)的包,比如不確定包的名稱時(shí),可以通過search來抹灰匹配。

  • yum update
    更新包,如果不指定包名,會(huì)更新所有已安裝的包。

  • yum update-to
    更新包到指定版本。

  • yum remove
    刪除指定的包以及任何依賴于被刪除的包的包,不能刪除yum自己。

  • yum clean
    清除yum緩存。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容