Ubuntu/Centos 下显示已安装包信息

本贴最后更新于 1846 天前,其中的信息可能已经时过境迁

Ubuntu

1.apt list --installed

如:

root@ubuntu:~# apt list --installed | grep docker

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

docker/bionic,now 1.5-1build1 amd64 [已安装]
docker-compose/bionic,bionic,now 1.17.1-2 all [已安装]
docker.io/bionic-security,bionic-updates,now 18.09.7-0ubuntu1~18.04.4 amd64 [已安装]
golang-docker-credential-helpers/bionic,now 0.5.0-2 amd64 [已安装,自动]
python-docker/bionic,bionic,now 2.5.1-1 all [已安装,自动]
python-dockerpty/bionic,bionic,now 0.4.1-1 all [已安装,自动]
python-dockerpycreds/bionic,bionic,now 0.2.1-1 all [已安装,自动]
python3-docker/bionic,bionic,now 2.5.1-1 all [已安装,自动]
python3-dockerpycreds/bionic,bionic,now 0.2.1-1 all [已安装,自动]
root@ubuntu:~# apt list --installed docker
正在列表... 完成
docker/bionic,now 1.5-1build1 amd64 [已安装]

2.dpkg --get-selections

如:

root@ubuntu:~# dpkg --get-selections | grep docker
docker						install
docker-compose					install
docker.io					install
golang-docker-credential-helpers		install
python-docker					install
python-dockerpty				install
python-dockerpycreds				install
python3-docker					install
python3-dockerpycreds				install
root@ubuntu:~# dpkg --get-selections docker
docker						install

3.dpkg -l

root@ubuntu:~# dpkg -l | grep docker
ii  docker                                 1.5-1build1                                     amd64        System tray for KDE3/GNOME2 docklet applications
ii  docker-compose                         1.17.1-2                                        all          Punctual, lightweight development environments using Docker
ii  docker.io                              18.09.7-0ubuntu1~18.04.4                        amd64        Linux container runtime
ii  golang-docker-credential-helpers       0.5.0-2                                         amd64        Use native stores to safeguard Docker credentials
ii  python-docker                          2.5.1-1                                         all          Python wrapper to access docker.io's control socket
ii  python-dockerpty                       0.4.1-1                                         all          Pseudo-tty handler for docker Python client (Python 2.x)
ii  python-dockerpycreds                   0.2.1-1                                         all          Python bindings for the docker credentials store API
ii  python3-docker                         2.5.1-1                                         all          Python 3 wrapper to access docker.io's control socket
ii  python3-dockerpycreds                  0.2.1-1                                         all          Python3 bindings for the docker credentials store API
root@ubuntu:~# dpkg -l docker
期望状态=未知(u)/安装(i)/删除(r)/清除(p)/保持(h)
| 状态=未安装(n)/已安装(i)/仅存配置(c)/仅解压缩(U)/配置失败(F)/不完全安装(H)/触发器等待(W)/触发器未决(T)
|/ 错误?=(无)/须重装(R) (状态,错误:大写=故障)
||/ 名称                                                      版本                              体系结构                          描述
+++-=========================================================-=================================-=================================-=======================================================================================================================
ii  docker                                                    1.5-1build1                       amd64                             System tray for KDE3/GNOME2 docklet applications

注意:以上命令无需 sudo 权限

Centos

1.yum list installed 列出所有已安装的软件包信息

如:

[root@centos ~]# yum list installed | grep docker
docker.x86_64                       2:1.13.1-103.git7f2769b.el7.centos @extras
docker-client.x86_64                2:1.13.1-103.git7f2769b.el7.centos @extras
docker-common.x86_64                2:1.13.1-103.git7f2769b.el7.centos @extras
[root@centos ~]# yum list installed docker
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
已安装的软件包
docker.x86_64

2.yum info installed 列出所有已安装的软件包信息

如:

[root@centos ~]# yum info installed | grep docker
名称    docker
网址    https://github.com/docker/docker
名称    docker-client
网址    https://github.com/docker/docker
名称    docker-common
简介     Common files for docker and docker-latest
网址    https://github.com/docker/docker
描述     This package contains the common files /usr/bin/docker which will
         : point to /usr/bin/docker-current or /usr/bin/docker-latest
         : configurable via /etc/sysconfig/docker
简介     OCI systemd hook for docker
描述     OCI systemd hooks enable running systemd in a OCI runc/docker
简介     OCI umount hook for docker
         :  - docker       Docker container
[root@centos ~]# yum info installed docker
已加载插件:fastestmirror
已安装的软件包
名称    :docker
架构    :x86_64
时期       :2
版本    :1.13.1
发布    :103.git7f2769b.el7.centos
大小    :65 M
源    :installed
来自源:extras
简介    : Automates deployment of containerized applications
网址    :https://github.com/docker/docker
协议    : ASL 2.0
描述    : Docker is an open-source engine that automates the deployment of any
         : application as a lightweight, portable, self-sufficient container that will
         : run virtually anywhere.
         :
         : Docker containers can encapsulate any payload, and will run consistently on
         : and between virtually any server. The same container that a developer builds
         : and tests on a laptop will run at scale, in production*, on VMs, bare-metal
         : servers, OpenStack clusters, public instances, or combinations of the above.

3.yum list <package_name> 列出所指定的软件包

如:

[root@centos ~]# yum list | grep docker
docker.x86_64                            2:1.13.1-103.git7f2769b.el7.centos
docker-client.x86_64                     2:1.13.1-103.git7f2769b.el7.centos
docker-common.x86_64                     2:1.13.1-103.git7f2769b.el7.centos
cockpit-docker.x86_64                    195.1-1.el7.centos.0.1          extras
containerd.io.x86_64                     1.2.6-3.3.el7                   docker-ce-stable
docker-ce.x86_64                         3:19.03.2-3.el7                 docker-ce-stable
docker-ce-cli.x86_64                     1:19.03.2-3.el7                 docker-ce-stable
docker-ce-selinux.noarch                 17.03.3.ce-1.el7                docker-ce-stable
docker-client-latest.x86_64              1.13.1-58.git87f2fab.el7.centos extras
docker-compose.noarch                    1.18.0-4.el7                    epel
docker-distribution.x86_64               2.6.2-2.git48294d9.el7          extras
docker-latest.x86_64                     1.13.1-58.git87f2fab.el7.centos extras
docker-latest-logrotate.x86_64           1.13.1-58.git87f2fab.el7.centos extras
docker-latest-v1.10-migrator.x86_64      1.13.1-58.git87f2fab.el7.centos extras
docker-logrotate.x86_64                  2:1.13.1-103.git7f2769b.el7.centos
docker-lvm-plugin.x86_64                 2:1.13.1-103.git7f2769b.el7.centos
docker-novolume-plugin.x86_64            2:1.13.1-103.git7f2769b.el7.centos
docker-registry.x86_64                   0.9.1-7.el7                     extras
docker-v1.10-migrator.x86_64             2:1.13.1-103.git7f2769b.el7.centos
golang-github-fsouza-go-dockerclient-devel.x86_64
kdocker.x86_64                           4.9-1.el7                       epel
pcp-pmda-docker.x86_64                   4.3.2-2.el7                     base
podman-docker.noarch                     1.4.4-4.el7.centos              extras
python-docker-py.noarch                  1:1.10.6-9.el7_6                extras
python-docker-pycreds.noarch             1:0.3.0-9.el7_6                 extras
python-docker-scripts.noarch             0.4.4-1.el7                     epel
python-dockerfile-parse.noarch           0.0.5-1.el7                     epel
python2-avocado-plugins-runner-docker.noarch
python2-docker-squash.noarch             1.0.7-3.el7                     epel
python2-dockerpty.noarch                 0.4.1-10.el7                    epel
python36-docker.noarch                   2.6.1-3.el7                     epel
python36-docker-pycreds.noarch           0.2.1-2.el7                     epel
python36-dockerpty.noarch                0.4.1-10.el7                    epel
[root@virtual-machine ~]# yum list docker
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
已安装的软件包
docker.x86_64

4.rpm -qa 查看已安装的组件

[root@centos ~]# rpm -qa|grep docker
docker-ce-18.09.0-3.el7.x86_64
docker-ce-cli-18.09.0-3.el7.x86_64
  • Linux

    Linux 是一套免费使用和自由传播的类 Unix 操作系统,是一个基于 POSIX 和 Unix 的多用户、多任务、支持多线程和多 CPU 的操作系统。它能运行主要的 Unix 工具软件、应用程序和网络协议,并支持 32 位和 64 位硬件。Linux 继承了 Unix 以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。

    930 引用 • 937 回帖
  • Ubuntu

    Ubuntu(友帮拓、优般图、乌班图)是一个以桌面应用为主的 Linux 操作系统,其名称来自非洲南部祖鲁语或豪萨语的“ubuntu”一词,意思是“人性”、“我的存在是因为大家的存在”,是非洲传统的一种价值观,类似华人社会的“仁爱”思想。Ubuntu 的目标在于为一般用户提供一个最新的、同时又相当稳定的主要由自由软件构建而成的操作系统。

    124 引用 • 169 回帖
  • CentOS

    CentOS(Community Enterprise Operating System)是 Linux 发行版之一,它是来自于 Red Hat Enterprise Linux 依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定的服务器以 CentOS 替代商业版的 Red Hat Enterprise Linux 使用。两者的不同在于 CentOS 并不包含封闭源代码软件。

    238 引用 • 224 回帖 • 1 关注

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...