Ubuntu package commands

Because Ubuntu has a mix of utilities to manage packages I constantly seem to be forgetting the options I need when I go to do basic package management. Mostly for my sake are the ones I use most regularly:

List installed packages:

dpkg -l
dpkg --get-selections

List names of available packages (including those not installed):

apt-cache pkgnames

Tell what package owns what file:

apt-file search FILE
dsearch -s FILE

List files in a given package:

dpkg --listfiles PACKAGE
dpkg-query -L PACKAGE

Force a package reinstall:

apt --reinstall install PACKAGE

Show general package information:

apt-cache show PACKAGE
dpkg --print-avail PACKAGE

Show package dependency information:

apt-cache showpkg PACKAGE

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *