[CONTACT]

[ABOUT]

[POLICY]

debian du This will be quick

Found at: demu.red:70/blog/010-dpgk_saving_space.md

Title: How to save space with dpkg
Date: 2016-08-24 09:26
Category: debian
Tags: CLI, debian, linux, unix, dpkg, ncdu, du
This will be a quick post. While the subject is simple it seemed worth sharing... As it was new information to me.
###OCD: Obsessively Cleaning your Directories
Some of you out there work on minimal setups (ie: low disk space, embedded, etc).
Others of you likely get annoyed by wasted disk space.
House cleaning my filesystem also has the benefit of speeding up [My Backups].
    :::bash
    ~ -> du -hcs /usr/share/doc/texlive-doc/
    1.1G    /usr/share/doc/texlive-doc/
    1.1G    total
After a number of months of staring at the disk usage, I finally decided to figure out how to free it up.
###Your Daily Dose of the Esoteric and Arcane: dpkg
While this may not be the most outlandish, this is a reoccurring theme with my computer knowledge; perhaps it will be one with my blog as well. *wink*
Meet my new friends `path-exclude` and `path-include`.
The use of these is as simple as adding a config to `/etc/dpkg/dpkg.cfg.d/`.  
**Note:** The order of your lines matters, as the later a line the higher priority it has over the previous lines.
###The Config File
`/etc/dpkg/dpkg.cfg.d/excludes`
    :::bash
    ## Drop locales except english and japanese
    path-exclude=/usr/share/locale/*
    path-include=/usr/share/locale/en/*
    path-include=/usr/share/locale/en_US/*
    path-include=/usr/share/locale/ja/*
    path-include=/usr/share/locale/locale.alias
    ## Drop translated manual pages except english and japanese
    path-exclude=/usr/share/man/*
    path-include=/usr/share/man/man[1-9]/*
    path-include=/usr/share/man/en*/*
    path-include=/usr/share/man/ja*/*
    ## Drop annoyingly large texlive-doc
    path-exclude=/usr/share/doc/texlive-doc/*
[My Config File]
This saves me over a gigabyte of space from unused man pages, locales, and of course texlive-doc.
Disk space saving isn't immediate, every time you install or upgrade a package the rules get evaluated and the excludes happen.
Here I allow English and Japanese to install, one of these days I might actually learn the latter.  
**Note:** If you need immediate relief, you have two options.
    * This is likely to have a few issues, at least on sid.
    * Do so at your own risk, reading my blog comes with ***no warranties!***
###Links
[My Backups]  
[My Config File]  
[My Backups]: {filename}006-backups_options_and_effort.md
[My Config File]: https://notabug.org/demure/dotfiles/src/master/system_wide/etc/dpgk/dpkg.cfg.d/excludes


AD: