Debian Admin published a guide about package management using dpkg under Debian/Ubuntu
Dpkg is the Debian package manager dpkg is a medium-level tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg is dselect.dpkg itself is controlled entirely via command line parameters,which consist of exactly one action and zero or more options. The action-parameter tells dpkg what to do and options control the behavior of the action in some way.Debian/Ubuntu Package management Using dpkg