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. I'm just going to assume you fall in both categories, as you read my blog and must be an awesome person. :D (lets see if my copy editors let me keep this informal tone)

Personally, I get annoyed at useless large disk usage. House cleaning my filesystem also has the benefit of speeding up My Backups.

I had been staring at my /usr/share/doc/texlive-doc/ for a while, when running ncdu to check on my disk usage. It was just there, taking up a gigabyte or so.

~ -> du -hcs /usr/share/doc/texlive-doc/
1.1G    /usr/share/doc/texlive-doc/
1.1G    total

I have yet to ever read the TeX documentation... And I'm not sure if I ever will have the motivation (ie: a fancy project) to do so. 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

In my research on the proper way to deal with this issue on debian sid, I found that dpkg has the ability to exclude and include paths from being installed. 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

## 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.

  1. Reinstall all packages.
    • This is likely to have a few issues, at least on sid.
  2. Carefully rm directories and files.
    • Do so at your own risk, reading my blog comes with no warranties!

My Backups
My Config File

- demure