A chronological documentation test project, nothing serious, really!

19 Mar 2008 dpkg command cheatsheet

Syntax Description Example
dpkg -i {.deb package} Install the package dpkg -i zip_2.31-3_i386.deb
dpkg -i {.deb package} Upgrade package if it is installed else install a fresh copy of package dpkg -i zip_2.31-3_i386.deb
dpkg -R {Directory-name} Install all packages recursively from directory dpkg -R /tmp/downloads
dpkg -r {package} Remove/Delete an installed package except configuration files dpkg -r zip
dpkg -P {package} Remove/Delete everything including configuration files dpkg -P apache-perl
dpkg -l List all installed packages, along with package version and short description dpkg -l
dokg -l | less
dpkg -l ‘*apache*’
dpkg -l | grep -i ‘sudo’
dpkg -l {package} List individual installed packages, along with package version and short description dpkg -l apache-perl
dpkg -L {package} Find out files are provided by the installed package i.e. list where files were installed dpkg -L apache-perl
dpkg -L perl
dpkg -c {.Deb package} List files provided (or owned) by the package i.e. List all files inside debian .deb package file, very useful to find where files would be installed dpkg -c dc_1.06-19_i386.deb
dpkg -S {/path/to/file} Find what package owns the file i.e. find out what package does file belong dpkg -S /bin/netstat
dpkg -S /sbin/ippool
dpkg -p {package} Display details about package package group, version, maintainer, Architecture, display depends packages, description etc dpkg -p lsof
dpkg -s {package} | grep Status Find out if Debian package is installed or not (status) dpkg -s lsof | grep Status

{package} – Replace with actual package name

Tags: , , ,

Posted by

26 Sep 2007 Advanced APT user tricks

Debian/Ubuntu apt-get tricks.


Install software

apt-get install foobar

Search software

apt-cache search foobar

You can query files to see which packages own them, or query packages to see which files own them.

Installing apt-file

apt-get install apt-file

Build apt-get file information cache

apt-file update

Query through the packages to determine which package contains the file

apt-file search mysqld

Query the other way around, you know the package name and would like info about all the files which are provided by a given pacage:

apt-file list mysqld

List all installed software/packages

dpkg --get-selections > software.txt

That will save your installed list to a file called software.txt. That list is every piece of software required to reproduce the state your PC is currently in.
Another way to get a full list of installed software is to run the command

dpkg --list

To restore a PC the list above

# dpkg --set-selections < software.txt
# apt-get dselect-upgrade

Clearing up space
Delete archived packages that are considered old.

# apt-get autoclean

Delete all archieved packages

# apt-get clean

Remove every file from a package

apt-get remove foobar --purge

Tags: , , , , ,

Posted by

30 Apr 2007 Finding which package contains a file in Debian

There are times when you’re looking for a particular library, or file, which you know is available to Debian/Ubuntu but you cannot find the package which contains it. This is the kind of job that the Debian packages site helped with in the past, but given its current unavailability we’ll look at another approach. (more…)

Tags: , , , ,

Posted by

27 Apr 2007 Howto duplicate a Debian setup

This post describes howto reinstall or duplicate a Debian or Debian based distribution like Ubuntu.
First we need to extract the installed packages on the source server and save them in a file

debian:~# dpkg --get-selections >> packages

Now we move to the target server and set the package selections according to the package file we just created on the source machine.

debian:~# dpkg --set-selections < < packages

Now we just need to run this in order to actually install the packages.

debian:~# apt-get -u dselect-upgrade

Tags: , ,

Posted by