Leif160519的blog Leif160519的blog

——————

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

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

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

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题Ubuntu/Centos下显示已安装包信息
作  者Leif160519
出  处https://github.icu/articles/2019/09/24/1569310095788.html
关于博主:坐标南京,运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!