Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
49
rated 0 times [  49] [ 0]  / answers: 1 / hits: 42485  / 3 Years ago, wed, august 4, 2021, 1:38:21

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.


More From » uninstall

 Answers
1

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
# if you also want to remove the man pages uncomment the next line
#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/groff/* /usr/share/info/*
rm -rf /usr/share/lintian/* /usr/share/linda/* /var/cache/man/*


If you also want to remove the man pages do:



rm -rf /usr/share/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.


[#38858] Thursday, August 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ormlai

Total Points: 292
Total Questions: 106
Total Answers: 115

Location: Cape Verde
Member since Fri, Sep 16, 2022
2 Years ago
;