apt-dpkg-ref APT, Dpkg Quick Reference sheet 

/usr/share/doc/apt-dpkg-ref/apt-dpkg-ref.html

Debian cmd:dpkg-deb 

dpkg-deb -c $dpkg | less
dpkg-deb is for manipulating *.deb files;
dpkg is for installing and deinstalling packages.
-c|--contents <deb>               list contents.
-I|--info <deb> [<cfile>...]      show info to stdout.
-W|--show <deb>                   show information on package(s)

Debian cmd:dpkg 

install packages 

dpkg -i --force-overwrite /var/cache/apt/archives/acroread_7.0.8-0.0_i386.deb

Or extract it to a foo dir.

dpkg-deb -x <package> foo/

removing packages 

completely remove, including left overs 

dpkg --purge gdm
Tip !!
% agr exim4-base exim4-config
Package exim4-base is not installed, so not removed
Package exim4-config is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

% dpkg --purge exim4-base exim4-config
Removing exim4-base ...
Purging configuration files for exim4-base ...
Removing exim4-config ...
Purging configuration files for exim4-config ...

completely remove all left overs 

Having done removing and adding packages, a good way to clean up is by typing this

COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' | xargs -t dpkg -P

remove all of KDE packages 

apt-get remove libarts1

remove packages despite of dependencies 

dpkg --force-depends --purge dselect

hold a Debian package not to install 

echo $package hold | dpkg --set-selections
Note this will not work for aptitude. For aptitude, use aptitude's own holding mechanism instead.

package listing 

$ dpkg -l wget
Desired=Unknown/Install/Remove/Purge/Hold
 | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
 |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
 ||/ Name           Version        Description
ii  wget           1.5.3-3        utility to retrieve files from the WWW via H
dpkg -l '*alsa*'
-- will list all the package names have "alsa" with it.
dpkg -l '*alsa*' | grep -v '<none>'
-- list all *installed alsa related packages

package query 

dpkg -S|--search <pattern> ...           find package(s) owning file(s)
$ dpkg -S wget
wget: /usr/bin/wget
[...]
perl-5.004: /usr/lib/perl5/5.004/newgetopt.pl
wget: /usr/share/info/wget.info-3.gz
perl-5.005: /usr/lib/perl5/5.005/newgetopt.pl
wget: /usr/share/doc/wget/copyright
[...]

Detail info 

$ dpkg -p wget
 Package: wget
 Priority: optional
 Section: web
Installed-Size: 558
 Architecture: i386
 Version: 1.5.3-3
 Depends: libc6 (>= 2.1)
 Filename: dists/frozen/main/binary-i386/web/wget_1.5.3-3.deb
 Size: 227728
MD5sum: 1fd5341edf1e673109861de1aff585ed
Description: utility to retrieve files from the WWW via HTTP and FTP
 Wget [formerly known as Geturl] is a freely available network utility

$ dpkg -s wget
 Package: wget
 Status: install ok installed
 Priority: optional
[... rest are the same as above ...]

File info 

$ dpkg -L wget
/.
/usr
/usr/bin
/usr/bin/wget
/usr/share
/usr/share/info
/usr/share/info/wget.info-2.gz
[...]

Yes! that's what I'm looking for.

File 

Newsgroups:  gmane.linux.debian.user
Date:        Tue, 10 Aug 2004 16:10:43 -0400

On Tue, 2004-08-10 at 13:48, Thomas Adam wrote:

> > Could somebody please attach and email me /etc/init.d/mysql?
> >
> > I accidentaly deleted it
>
> apt-get --reinstall install mysql-server

Or get the package and extract it to a foo dir.

dpkg-deb -x <package> foo/

Then fish it out of there.

Greg Folkert