3

I have Ubuntu 18.04 LTS. There seem to be thousands of gzip archive files, eg stored under the /usr/share/man folder and its sub-folders, which I'd like to get rid of as they just clutter up my drive. There are many more also listed under /usr/share/doc folder and sub-folders and many other places besides these examples.

Is it safe to delete all of these gz files or would they ever be needed by the system?

0
3

At first I'll quote the steeldriver's comment:

It's a bad idea to manually delete any files installed by the package manager - it will get confused.

I'm completely agree with it.

Then let's discuss the filesizes problem. I'm writing this from the Ubuntu MATE 16.04.6 LTS with many applications installed.

Even on it I have the following:

$ du -sh /usr/share/man
72M   /usr/share/man

But /usr/share/doc is bigger:

$ du -sh /usr/share/doc
2,3G  /usr/share/doc

But why does /usr/share/doc is bigger? Let's run ncdu on this folder:

$ sudo ncdu /usr/share/doc

ncdu 1.11 ~ Use the arrow keys to navigate, press ? for help                                                                                         
--- /usr/share/doc ----------------------------------------------------------------------------------------------------------------------------------
    1,5 GiB [##########] /texlive-doc                                                                                                                
  153,3 MiB [#         ] /gnuradio-doc
   67,3 MiB [          ] /fp-docs
   25,3 MiB [          ] /kde
   23,9 MiB [          ] /eagle
   22,8 MiB [          ] /python-cherrypy3
   20,0 MiB [          ] /libopenscap-dev
   15,7 MiB [          ] /octave-htmldoc
   13,6 MiB [          ] /nautilus-actions
   13,4 MiB [          ] /gcc-4.8-base
   13,0 MiB [          ] /uhd-host
   10,8 MiB [          ] /HTML
    9,4 MiB [          ] /maxima-doc
    9,3 MiB [          ] /avr-libc
    8,1 MiB [          ] /libx11-dev
    7,2 MiB [          ] /libjanino-java
    7,1 MiB [          ] /virtualbox-5.1
    6,7 MiB [          ] /openjdk-8-jre-headless
    6,2 MiB [          ] /python-logilab-common
    5,7 MiB [          ] /graphviz
    5,3 MiB [          ] /mibrfcs
    5,2 MiB [          ] /asymptote-doc
    5,2 MiB [          ] /ngspice-doc
    4,7 MiB [          ] /autoconf-archive
    4,5 MiB [          ] /liblcms2-dev
    4,2 MiB [          ] /octave-doc
    3,9 MiB [          ] /groff-base
    3,8 MiB [          ] /latex2html
    3,3 MiB [          ] /libgnuinet-java
    3,1 MiB [          ] /texstudio
    2,9 MiB [          ] /libsane
    2,9 MiB [          ] /dblatex
    2,8 MiB [          ] /dia
    2,6 MiB [          ] /android
    2,6 MiB [          ] /gcc-4.6-base
    2,4 MiB [          ] /mesa-common-dev
 Total disk usage:   2,2 GiB  Apparent size:   2,0 GiB  Items: 98961

So here I have about 1.5 Gb of useful stuff from TeXLive with TeX templates and documentation.
If you do not have TeXLive installed, then this folder would be smaller.


You should also know that both folders are used by Help browser for GNOME named Yelp from yelp package. So you can read many official documents offline.

If you open it, then:

  • press Ctrl+L and write here man:man (or call Yelp from terminal with yelp man:man) then you will get man-page for man command -

    yelp man:man

  • navigate to All Help then you will get many html-based help pages -

    yelp all help

So these folders are very useful for offline use.


But if you are really know what are you doing, then you can remove documentation-only packages (having -doc suffix) with command like:

sudo apt purge $(dpkg -l | grep -- '-doc\b' | awk '{print $2}')

(on my system it plans to remove 1 444 MB, in which are 1 086 MB for TexLive-related and 358 MB for others)

0

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.