Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I like to create a rather small Ubuntu installation in a Virtual Box machine. It should basically just provide TeX Live and related tools. I figured now that I have almost 1GB of data under /usr/share/doc. I don't need this documentation in this case, just the LaTeX related man pages, which are not located there.

Is there a way to uninstall all these documentation files using apt-get?
Alternatively, is it reasonably save to just delete the content of /usr/share/doc?
I like to share the Virtual Box machine with others, which shouldn't run in trouble.

share|improve this question

5 Answers 5

up vote 4 down vote accepted

According to the Ubuntu wiki, you can instruct dpkg not to install any documentation. This should prevent any documentation (except copyright info) from being installed by apt.

Create a file /etc/dpkg/dpkg.cfg.d/01_nodoc which specifies the desired filters. Example:

path-exclude /usr/share/doc/*
# we need to keep copyright files for legal reasons
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
# lintian stuff is small, but really unnecessary
path-exclude /usr/share/lintian/*
path-exclude /usr/share/linda/*

Then you can manually remove any documentation already installed:

find /usr/share/doc -depth -type f ! -name copyright|xargs rm || true
find /usr/share/doc -empty|xargs rmdir || true
rm -rf /usr/share/man /usr/share/groff /usr/share/info /usr/share/lintian > /usr/share/linda /var/cache/man

The example is written for OEMs, but it worked just as well for me. Took my /usr/share/doc/ directory down from ~150MB to ~20MB.

share|improve this answer

Do you know what is taking up all of that space? My /usr/share/doc is only ~50MB. If not, use the Disk Analyzer application or go to the terminal and run cd /usr/share/doc; then run du -h -d 1 to find out what is using all of that space. Once you know which program or program are the problem then you can decide if you should remove the directories in /usr/share/doc or not.

share|improve this answer
    
I was not aware that the directory names under /usr/share/doc are the packages names. At least of some this seems to be true. I used du -sc * | sort -n in /usr/share/doc. Most space was taken from the TeX Live 2009 documentation files which I don't want anyway, because I have the manually installed TL 2011 ones. Thanks, while I still like to see if there is a way to tell apt-get to get ride of most documentation, this solution worked out fine for this case. –  Martin Scharrer May 2 '12 at 16:27

This should remove the documentation for latex-related packages:

sudo apt-get --purge remove tex.\*-doc$

It does save a few hundred MB.

share|improve this answer
    
This seems to remove my texlive-full package too. –  joar Aug 8 '13 at 18:03

is it reasonably sa[f]e to just delete the content of /usr/share/doc?

If you do that, the files will get reinstalled when any of the packages get upgraded. You should instead remove the relevant documentation packages, which often (but not always) end in -doc.

share|improve this answer

Quick-and-dirty way to find the installed texlive packages (I'm 100% sure there are other ways):

dpkg -l | grep '^ii.*texlive.*doc'

And removing them:

apt-get remove --purge \
  texlive-fonts-recommended-doc texlive-latex-base-doc texlive-latex-extra-doc \
  texlive-latex-recommended-doc texlive-pictures-doc texlive-pstricks-doc
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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