【apt】查询和安装指定版本软件


1. 查询安装包版本

网站:https://packages.ubuntu.com/

2. apt-cache madison <>查询

其他操作

apt-cache madison vim
apt-cache policy vim
apt-cache showpkg vim
apt-get install -s vim
aptitude versions vim
apt-show-versions -a vim
whohas -d Debian,Ubuntu vim | tr -s ' ' '\t' | cut -f 1-3 | column -t
rmadison -u debian,ubuntu,bpo vim | cut -d "|" -f 1-3
apt-cache show vim
dpkg -l vim
dpkg -s vim
dpkg-query -s vim
apt-cache show vim| grep Version
apt-show-versions | more

master@master:~/phabricator/phabricator$ apt-cache madison vim
       vim | 2:8.1.2269-1ubuntu5.7 | http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages
       vim | 2:8.1.2269-1ubuntu5.7 | http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages
       vim | 2:8.1.2269-1ubuntu5 | http://mirrors.aliyun.com/ubuntu focal/main amd64 Packages
master@master:~/phabricator/phabricator$ apt-cache policy vim
vim:
  Installed: 2:8.1.2269-1ubuntu5.7
  Candidate: 2:8.1.2269-1ubuntu5.7
  Version table:
 *** 2:8.1.2269-1ubuntu5.7 500
        500 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages
        500 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2:8.1.2269-1ubuntu5 500
        500 http://mirrors.aliyun.com/ubuntu focal/main amd64 Packages
master@master:~/phabricator/phabricator$ apt-cache showpkg vim
Package: vim
Versions: 
2:8.1.2269-1ubuntu5.7 (/var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal-updates_main_binary-amd64_Packages) (/var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal-security_main_binary-amd64_Packages) (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_binary-amd64_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_binary-i386_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: en
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_i18n_Translation-en
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal-updates_main_binary-amd64_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal-updates_main_binary-i386_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8

2:8.1.2269-1ubuntu5 (/var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_binary-amd64_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_binary-amd64_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_binary-i386_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: en
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal_main_i18n_Translation-en
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal-updates_main_binary-amd64_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.aliyun.com_ubuntu_dists_focal-updates_main_binary-i386_Packages
                  MD5: 59e8b8f7757db8b53566d5d119872de8


Reverse Depends: 
  byobu,vim
  vim-syntax-docker,vim
  vim:i386,vim
  vim-runtime,vim
  vim-common,vim
  ubuntu-server,vim
  x2gothinclient-chroot,vim
  vim-tlib,vim
  vim-textobj-user,vim
  vim-tabular,vim
  vim-syntax-docker,vim
  vim-syntastic,vim
  vim-snippets,vim
  vim-snipmate,vim
  vim-scripts,vim
  vim-scripts,vim
  vim-rails,vim
  vim-puppet,vim
  vim-pathogen,vim
  vim-migemo,vim
  vim-ledger,vim
  vim-latexsuite,vim
  vim-latexsuite,vim
  vim-lastplace,vim
  vim-khuno,vim
  vim-julia,vim
  vim-gocomplete,vim
  vim-fugitive,vim
  vim-ctrlp,vim
  vim-bitbake,vim
  vim-autopep8,vim
  vim-airline-themes,vim
  vim-airline,vim
  vim-addon-mw-utils,vim
  vim-addon-manager,vim
  universal-ctags,vim
  tpp,vim
  supercollider-vim,vim
  ocaml-tools,vim
  lubuntu-desktop,vim
  libvi-quickfix-perl,vim
  imediff,vim
  halibut,vim
  gworkspace-apps-wrappers,vim
  games-python3-dev,vim
  games-python2-dev,vim
  games-c++-dev,vim
  dnsvi,vim
  dms-core,vim
  dms,vim
  debian-reference-common,vim
  biosyntax-vim,vim
  bikeshed,vim
  vim:i386,vim
  vim-runtime,vim
  vim-common,vim
  ubuntu-server,vim
  exuberant-ctags,vim
Dependencies: 
2:8.1.2269-1ubuntu5.7 - vim-common (5 2:8.1.2269-1ubuntu5.7) vim-runtime (5 2:8.1.2269-1ubuntu5.7) libacl1 (2 2.2.23) libc6 (2 2.29) libcanberra0 (2 0.2) libgpm2 (2 1.20.7) libpython3.8 (2 3.8.2) libselinux1 (2 1.32) libtinfo6 (2 6) ctags (0 (null)) vim-doc (0 (null)) vim-scripts (0 (null)) vim:i386 (32 (null)) 
2:8.1.2269-1ubuntu5 - vim-common (5 2:8.1.2269-1ubuntu5) vim-runtime (5 2:8.1.2269-1ubuntu5) libacl1 (2 2.2.23) libc6 (2 2.29) libcanberra0 (2 0.2) libgpm2 (2 1.20.7) libpython3.8 (2 3.8.2) libselinux1 (2 1.32) libtinfo6 (2 6) ctags (0 (null)) vim-doc (0 (null)) vim-scripts (0 (null)) vim:i386 (32 (null)) 
Provides: 
2:8.1.2269-1ubuntu5.7 - editor (= ) 
2:8.1.2269-1ubuntu5 - editor (= ) 
Reverse Provides: 
vim-nox 2:8.1.2269-1ubuntu5.7 (= )
vim-gtk3 2:8.1.2269-1ubuntu5.7 (= )
vim-athena 2:8.1.2269-1ubuntu5.7 (= )
vim-nox 2:8.1.2269-1ubuntu5 (= )
vim-gtk3 2:8.1.2269-1ubuntu5 (= )
vim-athena 2:8.1.2269-1ubuntu5 (= )
master@master:~/phabricator/phabricator$ apt-get install -s vim
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
vim is already the newest version (2:8.1.2269-1ubuntu5.7).
The following packages were automatically installed and are no longer required:
  adium-theme-ubuntu command-not-found-data dh-python diffstat g++-7 geoip-database gir1.2-gtksource-3.0 gir1.2-mutter-2 gnome-software-common golang-docker-credential-helpers
  guile-2.0-libs ifupdown intltool-debian iputils-arping libappstream-glib8 libapt-pkg-perl libargon2-0 libart-2.0-2 libasync-mergepoint-perl libavutil55 libblkid-dev
  libboost-system1.65.1 libcamel-1.2-61 libcdio17 libclass-xsaccessor-perl libclone-perl libcpanel-json-xs-perl libcrystalhd3 libdevel-size-perl libdns-export1100 libdvdread4
  libdynaloader-functions-perl libenchant1c2a libexempi3 libexporter-tiny-perl libffi6 libfile-copy-recursive-perl libfuture-perl libgail-3-0 libgdbm5 libgeoip1 libglew2.0
  libgnome-desktop-3-17 libgraphite2-dev libgrilo-0.3-0 libgspell-1-1 libgtksourceview-3.0-1 libgtksourceview-3.0-common libgutenprint-common libgutenprint2 libgweather-3-15
  libharfbuzz-gobject0 libhunspell-1.6-0 libicu-le-hb0 libicu60 libiculx60 libindicator3-7 libio-async-perl libio-string-perl libip4tc0 libip6tc0 libiptc0 libisc-export169
  libisc169 libisl19 libjson-c3 liblinux-epoll-perl liblist-compare-perl liblist-moreutils-perl libllvm10 liblouis14 libmagick++-6.q16-7 libmagickcore-6.q16-3 libmagickwand-6.q16-3
  libmozjs-52-0 libmutter-2-0 libmysqlclient20 libncursesw5 libnet-ip-perl libnetpbm10 libnginx-mod-http-geoip libnss-myhostname libntfs-3g88 liboauth0 libpackage-stash-xs-perl
  libpcre16-3 libpcre2-16-0 libpcre2-dev libpcre2-posix2 libpcre3-dev libpcre32-3 libpcrecpp0v5 libperl4-corelibs-perl libperl5.26 libpostproc54 libpython2.7 libpython3.6
  libpython3.6-dev libpython3.6-minimal libpython3.6-stdlib libqpdf21 libreadonly-perl libref-util-perl libref-util-xs-perl libruby2.5 libsane1 libselinux1-dev libsepol1-dev
  libsereal-decoder-perl libssl-dev libssl1.0.0 libstdc++-7-dev libstruct-dumb-perl libsub-exporter-progressive-perl libsub-identify-perl libtest-fatal-perl libtext-glob-perl
  libtext-levenshtein-perl libtype-tiny-perl libtype-tiny-xs-perl libunicode-utf8-perl libusbmuxd4 libvariable-magic-perl libx264-152 libxml-sax-base-perl libyaml-libyaml-perl
  libzeitgeist-2.0-0 light-themes linux-headers-generic-hwe-18.04 linux-hwe-5.4-headers-5.4.0-92 linux-hwe-5.4-headers-5.4.0-94 linux-hwe-5.4-headers-5.4.0-96
  linux-hwe-5.4-headers-5.4.0-97 linux-hwe-5.4-headers-5.4.0-99 multiarch-support nplan patchutils php7.2-opcache pppoeconf python-asn1crypto python-backports.ssl-match-hostname
  python-cached-property python-cffi-backend python-chardet python-enum34 python-functools32 python-idna python-pkg-resources python-talloc python-texttable python3-asn1crypto
  python3-oauth python3-zope.interface qpdf ruby-did-you-mean ruby2.5 ruby2.5-dev ruby2.5-doc t1utils ubuntu-artwork ubuntu-system-service uuid-dev xserver-xorg-core-hwe-18.04
  xserver-xorg-hwe-18.04 xserver-xorg-input-libinput-hwe-18.04 xserver-xorg-input-wacom-hwe-18.04 xserver-xorg-legacy-hwe-18.04 xserver-xorg-video-all-hwe-18.04
  xserver-xorg-video-amdgpu-hwe-18.04 xserver-xorg-video-ati-hwe-18.04 xserver-xorg-video-fbdev-hwe-18.04 xserver-xorg-video-intel-hwe-18.04 xserver-xorg-video-nouveau-hwe-18.04
  xserver-xorg-video-vesa-hwe-18.04 xserver-xorg-video-vmware-hwe-18.04
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
master@master:~/phabricator/phabricator$ aptitude versions vim

Command 'aptitude' not found, but can be installed with:

sudo apt install aptitude

master@master:~/phabricator/phabricator$ apt itude versions vim
E: Invalid operation itude
master@master:~/phabricator/phabricator$ aptitude versions vim

Command 'aptitude' not found, but can be installed with:

sudo apt install aptitude

master@master:~/phabricator/phabricator$ apt-show-versions -a vim

Command 'apt-show-versions' not found, but can be installed with:

sudo apt install apt-show-versions

master@master:~/phabricator/phabricator$ whohas -d Debian,Ubuntu vim | tr -s ' ' '\t' | cut -f 1-3 | column -t

Command 'whohas' not found, but can be installed with:

sudo apt install whohas

master@master:~/phabricator/phabricator$ rmadison -u debian,ubuntu,bpo vim | cut -d "|" -f 1-3

Command 'rmadison' not found, but can be installed with:

sudo apt install devscripts

master@master:~/phabricator/phabricator$ apt-cache show vim
Package: vim
Architecture: amd64
Version: 2:8.1.2269-1ubuntu5.7
Priority: optional
Section: editors
Origin: Ubuntu
Maintainer: Ubuntu Developers 
Original-Maintainer: Debian Vim Maintainers 
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 3039
Provides: editor
Depends: vim-common (= 2:8.1.2269-1ubuntu5.7), vim-runtime (= 2:8.1.2269-1ubuntu5.7), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
Suggests: ctags, vim-doc, vim-scripts
Filename: pool/main/v/vim/vim_8.1.2269-1ubuntu5.7_amd64.deb
Size: 1237864
MD5sum: cdf260995ab3c5982fdfc484a367ed71
SHA1: afe3264ddf153702774ae83c55d2a4563553f6f7
SHA256: ffae4ba8731e6a64c1c21c80eeb1be023e5af0b5bb2aba1675c32d217d29da50
SHA512: 017bd041ea72a2e8347b219366e4c7411c6ab2e92b99685c8894a89a48a20637e61b0a366fae725d9254c3338d627eb55924d96fa0842d44c6167e64373b2830
Homepage: https://www.vim.org/
Description-en: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 .
 This package contains a version of vim compiled with a rather
 standard set of features.  This package does not provide a GUI
 version of Vim.  See the other vim-* packages if you need more
 (or less).
Description-md5: 59e8b8f7757db8b53566d5d119872de8
Task: server, cloud-image, lubuntu-desktop

Package: vim
Architecture: amd64
Version: 2:8.1.2269-1ubuntu5
Priority: optional
Section: editors
Origin: Ubuntu
Maintainer: Ubuntu Developers 
Original-Maintainer: Debian Vim Maintainers 
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 3038
Provides: editor
Depends: vim-common (= 2:8.1.2269-1ubuntu5), vim-runtime (= 2:8.1.2269-1ubuntu5), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
Suggests: ctags, vim-doc, vim-scripts
Filename: pool/main/v/vim/vim_8.1.2269-1ubuntu5_amd64.deb
Size: 1237624
MD5sum: 198ccbb07a9fc8ebe67a213eab6a3e96
SHA1: 796c962d044f99a81b187211e6ce9a0a44b8d5d1
SHA256: 1e38f267bf4c06e424b166e8d666ffd6ce25c657012892d099651bee18a2c834
Homepage: https://www.vim.org/
Description-en: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 .
 This package contains a version of vim compiled with a rather
 standard set of features.  This package does not provide a GUI
 version of Vim.  See the other vim-* packages if you need more
 (or less).
Description-md5: 59e8b8f7757db8b53566d5d119872de8
Task: server, cloud-image, lubuntu-desktop

master@master:~/phabricator/phabricator$ dpkg -l vim
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version               Architecture Description
+++-==============-=====================-============-=================================
ii  vim            2:8.1.2269-1ubuntu5.7 amd64        Vi IMproved - enhanced vi editor
master@master:~/phabricator/phabricator$ dpkg -s vim
Package: vim
Status: install ok installed
Priority: optional
Section: editors
Installed-Size: 3039
Maintainer: Ubuntu Developers 
Architecture: amd64
Version: 2:8.1.2269-1ubuntu5.7
Provides: editor
Depends: vim-common (= 2:8.1.2269-1ubuntu5.7), vim-runtime (= 2:8.1.2269-1ubuntu5.7), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
Suggests: ctags, vim-doc, vim-scripts
Description: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 .
 This package contains a version of vim compiled with a rather
 standard set of features.  This package does not provide a GUI
 version of Vim.  See the other vim-* packages if you need more
 (or less).
Homepage: https://www.vim.org/
Original-Maintainer: Debian Vim Maintainers 
master@master:~/phabricator/phabricator$ dpkg-query -s vim
Package: vim
Status: install ok installed
Priority: optional
Section: editors
Installed-Size: 3039
Maintainer: Ubuntu Developers 
Architecture: amd64
Version: 2:8.1.2269-1ubuntu5.7
Provides: editor
Depends: vim-common (= 2:8.1.2269-1ubuntu5.7), vim-runtime (= 2:8.1.2269-1ubuntu5.7), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
Suggests: ctags, vim-doc, vim-scripts
Description: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 .
 This package contains a version of vim compiled with a rather
 standard set of features.  This package does not provide a GUI
 version of Vim.  See the other vim-* packages if you need more
 (or less).
Homepage: https://www.vim.org/
Original-Maintainer: Debian Vim Maintainers 
master@master:~/phabricator/phabricator$ apt-cache show vim| grep Version
Version: 2:8.1.2269-1ubuntu5.7
Version: 2:8.1.2269-1ubuntu5
master@master:~/phabricator/phabricator$ apt-show-versions | more

Command 'apt-show-versions' not found, but can be installed with:

sudo apt install apt-show-versions

 参考文章:https://www.cnblogs.com/EasonJim/p/7144017.html