A Linux User Reference

Search tips
  • search ignores words that are less than 4 characters in length
  • searches are case insensitve
  • if a search does not return anything try it in Boolean mode then Query expansion mode by checking the appropriate radio button e.g. searching for 'cron' in just the Administration category returns nothing - presumably because the 50% threshold is reached. Boolean mode ignores this threshold so a search for 'cron' returns several hits
  • in Boolean mode preceding a word with a '+' means the result must include that word, a '-' means it must not
  • in Boolean mode '+crontab -anacron' means match articles about crontab that DO NOT mention anacron
  • to match a phrase e.g. 'manage system' check the Boolean mode radio button and enclose the phrase in quotes "some phrase ..."
  • in Query expansion mode the search context is expanded beyond the keywords you entered - relevancy of hits may well be degraded


Debian packages

  • What are packages?
    • Each linux distribution commonly has its own means of packaging software.
    • These distributions usually provide package management software to work with their packages.

    Applications/frameworks tend to do the same - Python has its distutils tools and archive format, Perl has CPAN archives, Java has .jar files, Ruby has gems …

    Debian Packages have the extension .deb They are created using ar (cousin of tar) or some higher level tool that uses ar such as dpkg, dpkg-deb ...

    These tools along with APT (aptitude, apt-get ...) also work with .deb packages.

  • Create, modify and extract files from archives

    Display a verbose listing of the package

    $ ar tv aptoncd_0.1-1_all.deb
    rw-r--r-- 0/0      4 May 12 01:16 2007 debian-binary
    rw-r--r-- 0/0   3361 May 12 01:16 2007 control.tar.gz
    rw-r--r-- 0/0 196313 May 12 01:16 2007 data.tar.gz

    Verbosely extract files from the package

    $ ar xv aptoncd_0.1-1_all.deb
    x - debian-binary
    x - control.tar.gz
    x - data.tar.gz

    Uncompress files in the control tarball

    $ tar -xvfz control.tar.gz

    Is where the metadata lives - required. Might also find or wish to include scripts called postinst, prerm and postrm to take special steps after installation or before removal.


    Contains cryptographic hashes of all the distributed files for verification purposes.

  • Debian package naming

    Format: [package-name]_[version]-[release].deb


    When multiple words are used they are separated by a '-'

    Version number

    Each package has one, format varies, usually 'major.minor.patchlevel'

    File extension

    All debian packages end in '.deb'


  • Debian package states
    State Description
    installed Unpacked and configured ok
    half-installed Installation started but not completed
    not-installed Not installed
    unpacked Unpacked but not configured
    half-configured Unpacked, configuration started but not completes
    config-files Only config files exist i.e. package has been installed, removed but not purged
  • Package management files
    File name Description
    /etc/dpkg/dpkg.cfg Can contain default options for dpkg command
    /var/log/dpkg.log Default log location, can change in dpkg.cfg
    /var/lib/dpkg/available List of available packages, can search using grep instead of dpkg-query
    /var/lib/dpkg/status Status information of available packages - installed or not, marked for removal or not …
  • Debian package management usage examples

    List packages matching given pattern

    # dpkg-query -l 'aptoncd*'
    # dpkg-query --list 'aptoncd*'

    List status of given package

    # dpkg-query -s aptoncd
    # dpkg-query --status aptoncd

    Display details of available packages

    # dpkg-query -p aptoncd
    # dpkg-query --print-avail aptoncd

    Update list of available packages

    # dpkg --update-avail

    Clean out list of available packages

    # dpkg --clear-avail

    List all installed packages

    # dpkg -l

    List all files in this package

    # dpkg -L wpasupplicant
    # dpkg --listfiles wpasupplicant

    Filename(s) pattern search

    # dpkg -S wpasupp*
    # dpkg --search wpasupp*

    Install a package

    # dpkg -i aptoncd_0.1-1_all.deb
    # dpkg --install aptoncd_0.1-1_all.deb

    Do not install package if newer version exists

    # dpkg -G -i aptoncd_0.1-1_all.deb
    # dpkg --refuse-downgrade -i aptoncd_0.1-1_all.deb

    Do not overwrite a same version package

    # dpkg -E -i aptoncd_0.1-1_all.deb
    # dpkg --skip-same-version -i aptoncd_0.1-1_all.deb

    Unpack but do not configure package

    # dpkg --unpack aptoncd_0.1-1_all.deb

    Configure an unpacked package, -a for all unpacked packages

    # dpkg --configure aptoncd

    Remove installed package, leave config files

    # dpkg -r aptoncd

    Remove installed package and it's config files

    # dpkg -P aptoncd
    # dpkg --purge aptoncd

    Display partially installed packages, suggests ways to fix

    # dpkg -C
    # dpkg --audit

    Display a package's version, status and dependencies with a bit of formatting

    $ dpkg-query -W -f='Version:\t${Version}\nStatus:\
    \t\t${Status}\nDependencies:\t${Depends}\n' bash
    Status:install ok installed
    Dependencies:base-files (>= 2.1.12), debianutils (>= 2.15)

    Display a package's name and configuration files

    $ dpkg-query -W -f='${Package}\n${Conffiles}\n' wpasupplicant
      /etc/wpa_supplicant/ 4c1df8b9f2d64a8e3dcd1fc08d1e8db2
      /etc/wpa_supplicant/ 1d65fb9ccf039a360cb298118ad21dfe
      /etc/init.d/wpa-ifupdown 0dbdc73ac6a0e53ec429466a69e4cf95
      /etc/logrotate.d/wpa_action 2f64dd63ec9ccebb07b746910f6aeb04
  • Reconfigure an already installed package

    Reconfigure an already installed package

    # dpkg-reconfigure [options] packages

    To see the current configuration of a package use 'debconf-show'.

  • Query the debconf database

    Only contains information on packages that have been configured by debconf.

    List available debconf databases

    $ sudo debconf-show --listdbs
    [sudo] password for mark: 

    List current packages in the debconf db(s)

    $ sudo debconf-show --listowners | sort

    Display current debconf values for 'cups'

    $ sudo debconf-show cups
      cupsys/raw-print: true
      cupsys/backend: ipp, lpd, parallel, scsi, serial, socket, usb, snmp, dnssd
  • Menu-driven front-end for dpkg

    An interactive menu-driven front-end for dpkg. Usually run from the command line without any parameters/options.

  • Convert or install an alien binary package

    Will probably need to install. The Red Hat Package Manager needs to be installed on a system to convert to and from .rpm files.

    Convert to .deb or install non-Debian packages

    # alien --to-deb package.rpm
    # alien --to-rpm package.deb
    # alien --to-deb --to-tgz --to-rpm package.slp   (Creates .deb, .tgz and .rpm files)
    # alien -i package.rpm                           (Convert .rpm to .deb and install)
  • Advanced Package Tool (APT)

    APT does not work directly with .deb files as dpkg does, it uses software packages. It downloads/retrieves packages from repositories.

    The main APT files are as follows:

    File name Description
    /etc/apt/apt.conf APT configuration file
    /etc/apt/sources.list List of repositories
    /etc/apt/preferences Version preferences, pinning - get a particular version of software from a specific source
    /var/cache/apt/archives Store of retrieved package files
  • APT package handling utility examples
    /usr/bin/apt-get, apt-cache, aptitude

    Command-line interface


    Cache manipulator


    High-level interface to the package manager

    Retrieve current list of packages from all repositories

    # apt-get update

    Get more information on a package

    # apt-get show <pattern>

    Install a package

    # apt-get install <pattern>

    Remove a package

    # apt-get remove <pattern>

    Purge a package – removes configuration files as well

    # apt-get purge <pattern>

    Upgrade installed only

    # apt-get upgrade

    If a new version requires new packages it's not upgraded.

    Upgrade and remove/install packages as necessary

    # apt-get dist-upgrade

    Same proviso as 'apt-get upgrade'

    Upgrade installed packages to their most recent version

    # aptitude safe-upgrade

    Packages will NOT be removed unless they are unused - more conservative than 'full-upgrade'.

    Upgrade installed packages to their most recent version

    # aptitude full-upgrade

    Removes or installs packages as necessary - less conservative than 'safe-upgrade'

    Remove cached packages

    # apt-get clean

    Remove only earlier versions of cached packages

    # apt-clean autoclean

    Keyword search of available packages

    # apt-cache search <pattern>