To list installed packages related to the editor vi
(1) (note that
dpkg-query
does not load the available file anymore by default,
and the dpkg-query --load-avail
option should be used instead for
that):
dpkg -l '*vi*'
To see the entries in /usr/local/var/lib/dpkg/available of two
packages:
dpkg --print-avail elvis vim | less
To search the listing of packages yourself:
less /usr/local/var/lib/dpkg/available
To remove an installed elvis package:
dpkg -r elvis
To install a package, you first need to find it in an archive or
CDROM. The available file shows that the vim package is in
section editors
:
cd /media/cdrom/pool/main/v/vim
dpkg -i vim_4.5-3.deb
To make a local copy of the package selection states:
dpkg --get-selections >myselections
You might transfer this file to another computer, and after
having updated the available file there with your package manager
frontend of choice (see https://wiki.debian.org/Teams/Dpkg/FAQ
for more details), for example:
apt-cache dumpavail | dpkg --merge-avail
or with dpkg 1.17.6 and earlier:
avail=`mktemp`
apt-cache dumpavail >"$avail"
dpkg --merge-avail "$avail"
rm "$avail"
you can install it with:
dpkg --clear-selections
dpkg --set-selections <myselections
Note that this will not actually install or remove anything, but
just set the selection state on the requested packages. You will
need some other application to actually download and install the
requested packages. For example, run apt-get dselect-upgrade
.
Ordinarily, you will find that dselect(1) provides a more
convenient way to modify the package selection states.