When setting up/rolling up multiple transient VMs, I would like to keep the used disk space at a minimum, not installing the documents and corresponding manuals of the standard software packages (and possibly other directories).

However, since Debian does not offer separate packages, and all comes in the same .deb package, how could it be done?


Coincidentally (or not), the package manager, namely dpkg, can be instructed to ignore placing files in specific directories while installing packages.

To do that, create in the /etc/dpkg/dpkg.cfg.d directory a file 01nodoc having as contents:

path-exclude /usr/share/doc/*
path-exclude /usr/share/man/*

apt and aptitude also honour those configurations, and as such, when installing any package, the corresponding files that would be installed in that directories are ignored.

Please do note however that this feature does not delete files retroactively; if they were installed at any point in time before configuring the exclusions, they have to be removed manually.

If however you want to use a subdirectory of an excluded path, use a path-include directive with a more specific path before the path-exclude.

See also Save disk space by excluding useless files with dpkg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.