There are two actions, they are dpkg-query and dpkg-deb.
# sudo dpkg -i {package_name}
# sudo dpkg -i skype-ubuntu-precise_4.2.0.11-1_i386.deb
# sudo dpkg -r {package_name}
# sudo dpkg -r vlc
# sudo dpkg -P {package_name}
# sudo dpkg -P vlc
You can pipe the command to less (a pager) so you can more easily scroll the content:
# dpkg -l | less
# dpkg -l {package_name}
# dpkg -l vlc
# dpkg -l | vlc
And this will show the location where the package will be installed. Here -S (capital S) to search whether the package was installed or not.
# sudo dpkg -S {package_name}
# sudo dpkg -S skype
Here -R is recursive. (Recursively handle all regular files matching the pattern *.deb found at specified directories and all of its subdirectories).
# sudo dpkg -R --install {package_location}
# sudo dpkg -R --install /home/sysadmin/soft
Here -p (lowercase p) will show the package info:
# dpkg -p {package_name}
# dpkg -p apache2
Use -c (lowercase c) to show the content:
# sudo dpkg -c {package_name}
# sudo dpkg -c skype-ubuntu-precise_4.2.0.11-1_i386.deb
*.deb package fileUse -x (lowercase x) to extract:
# dpkg -x {package_name} {location_were_to_extract}
# dpkg -x libqt4-phonon_4.6.3-4+squeeze1_i386.deb /home/sysadmin/
Use -X (uppercase X) to display the content with extraction.
# dpkg -X {package_name} {location_were_to_extract}
# dpkg -X libqt4-phonon_4.6.3-4+squeeze1_i386.deb /home/sysadmin/
Here -I stands for information:
# dpkg -I {package_name}
# dpkg -I libqt4-phonon_4.6.3-4+squeeze1_i386.deb
dpkg-reconfigure reconfigures packages after they already have been installed. Pass it the name(s) of a package or packages to reconfigure. It will ask configuration questions, much like when the package was first installed.
# dpkg-reconfigure postfix
This will reconfigure postfix the same way as when you installed it for the first time.
Need to know more about dpkg commands? Have a look at the manual page:
# man dpkg