I often find myself missing documentation when I happen to be offline. For this reason, I would like to force aptitude to install the corresponding doc packages whenever I install a package. Is there a way of doing that more elegant than putting an alias that goes through arguments and add the *-doc that exist before forwarding the arguments to aptitude?
Force installation of doc packages
debian;aptitude;documentation
The following shell snippet installs all FOO-doc packages such that FOO is already installed:apt-get install $(comm -12 <(dpkg --get-selections | awk '$2 == install {print $1 -doc}')                           <(apt-cache pkgnames | sort) )To make this a bit cleaner by omitting already-installed -doc packages:installed_packages=$(dpkg --get-selections | awk '$2 == install {print $1}')uninstalled_doc_packages=$(comm -13 <(printf '%s\n' $installed_packages)                                    <(printf '%s-doc\n' $installed_packages))missing_doc_packages=$(apt-cache pkgnames | sort |                       comm -12 - <(printf '%s\n' $uninstalled_doc_packages))apt-get install $missing_doc_packagesI don't think there's a handy way to run this automatically after a package installation or to automatically mark the -doc packages to be installed.  You can set a dpkg or apt hook, but it'll run after package removals, upgrades, etc., not just after installing packages.  