Ubuntu: How can I remove fonts that I never use, from libreoffice and linux in general?



Question:

There are a lot of extra fonts that all seem to look alike and just annoy me in the drop down list. Is there anyway I can erase them from the system?


Solution:1

You have several methods. I can list 4...

1. Graphical interface

Firstly you can install font-manager with this command:

sudo aptitude install font-manager  

You can disable (So not remove! Disabling makes them disappear for you but other users on that system will still see them) fonts from here. This is what it looks like:

enter image description here

2. Manual removal from Ubuntu Software Center

As an alternative have a search in Ubuntu Software Center for fonts and delete them from there.

3. Manual removal as packages through command line

None english fonts can be removed with this command:

sudo apt-get remove ttf-indic-fonts-core ttf-kacst-one ttf-khmeros-core ttf-lao ttf-punjabi-fonts ttf-takao-pgothic ttf-thai-tlwg ttf-unfonts-core ttf-wqy-microhei  

Here is a list of all the font packages. You can add the font package name to the command above to include them for removal.

If at any time you remove a font that you want back just do a

 sudo apt-get install ttf-indic-fonts-core  

And the indic fonts will be re-installed (ofc. change the package name to what you want).

4. Manual command line removal

Besides this you can look at

/etc/fonts/fonts.conf  

to see where fonts are stored. Normally this will be in 1 of these locations:

/usr/share/fonts  /usr/local/share/fonts  /home/$USER/.local/share/fonts  /home/$USER/.fonts  

With admin privileges you can just remove them. They should then disappear from any location.


Solution:2

It depends on how you installed the font.

Font installed system-wide

If it was installed system-wide (like most fonts are AFAIK) just pull Nautilus (Ubuntu's file manager) as root (Alt+F2 then enter gksudo nautilus) and navigate to /usr/share/fonts/truetype.

enter image description here

then

enter image description here

then

enter image description here

Delete the file and then run sudo fc-cache -f -v in Terminal.

Log out and back in again and it should be deleted.

Font installed for your user only

If it was installed just for you (manual copy-paste into the user ~/.fonts or ~/.local/share/fonts/ directory) then you can just delete the font from those directories and log out and back in again.

And just to be absolutely sure, do a: locate --existing szNameOfFile to remove all other occurrences of the same file so everything is back where it was!

Commands courtesy of @Fabby in chat


Solution:3

If you installed the font using the install button, it was likely just copied to ~/.fonts. To uninstall it, just open that directory, find the font, and delete the file.


Solution:4

If you have installed .ttf Microsoft core fonts mscorefonts-installer through terminal ctrl+alt+t.You can uninstall it as:

sudo apt-get remove ttf-mscorefonts-installer  


Solution:5

For Ubuntu 16.04 many non-western font families can removed by running this command in the terminal:

sudo apt remove fonts-lao fonts-lklug-sinhala fonts-sil-abyssinica fonts-sil-padauk fonts-tibetan-machine fonts-thai-tlwg fonts-lohit-guru fonts-guru-extra  

To make the font selection dialog look even less cluttered the Stix math symbol font family could be removed:

sudo apt remove fonts-stix  


Solution:6

If you want to check what fonts are installed on Debian/Ubuntu systems and derivatives you can run the command:

echo `dpkg -l fonts\*|grep ii|awk '{print $2}'|grep -vE 'fonts-(noto$|liberation|dejavu|freefont|hack)'`  

This command EXCLUDE fonts which I want to keep (you can put their names within parentheses). I excluded from this list package names like fonts-noto (explicitly), all fonts-liberation packages, and so on. The list of packages installed can look like the following:

fonts-beng fonts-beng-extra fonts-deva fonts-deva-extra fonts-gargi fonts-gubbi fonts-gujr fonts-gujr-extra fonts-kacst fonts-kacst-one fonts-kalapi fonts-khmeros-core fonts-knda fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva fonts-lohit-gujr fonts-lohit-knda fonts-lohit-mlym fonts-lohit-orya fonts-lohit-taml fonts-lohit-taml-classical fonts-lohit-telu fonts-mathjax fonts-mlym fonts-nakula fonts-nanum fonts-navilu fonts-noto-cjk fonts-noto-hinted fonts-noto-mono fonts-noto-unhinted fonts-opensymbol fonts-orya fonts-orya-extra fonts-pagul fonts-sahadeva fonts-samyak-deva fonts-samyak-gujr fonts-samyak-mlym fonts-samyak-taml fonts-sarai fonts-smc fonts-symbola fonts-takao-pgothic fonts-taml fonts-telu fonts-telu-extra fonts-tlwg-garuda fonts-tlwg-garuda-ttf fonts-tlwg-kinnari fonts-tlwg-kinnari-ttf fonts-tlwg-laksaman fonts-tlwg-laksaman-ttf fonts-tlwg-loma fonts-tlwg-loma-ttf fonts-tlwg-mono fonts-tlwg-mono-ttf fonts-tlwg-norasi fonts-tlwg-norasi-ttf fonts-tlwg-purisa fonts-tlwg-purisa-ttf fonts-tlwg-sawasdee fonts-tlwg-sawasdee-ttf fonts-tlwg-typewriter fonts-tlwg-typewriter-ttf fonts-tlwg-typist fonts-tlwg-typist-ttf fonts-tlwg-typo fonts-tlwg-typo-ttf fonts-tlwg-umpush fonts-tlwg-umpush-ttf fonts-tlwg-waree fonts-tlwg-waree-ttf fonts-wqy-microhei  

As you can see, this is a rather long list, but it's important to INVESTIGATE it and remove any valuable package which may exists on it. Then, this list should be save to a file, using file redirection (> file):

echo `dpkg -l fonts\*|grep ii|awk '{print $2}'|grep -vE 'fonts-(noto$|liberation|dejavu|freefont|hack)'` >  not-needed-font-packages.txt  

Now, having this file you can always restore (install again) all packages which you will get rid of. To remove all unnecessary packages which names are collected in that file, you can run the command which will test the system response to this potentially destructive operation:

sudo dpkg --remove --dry-run `cat not-needed-font-packages.txt`  

This will check what package WILL be removed. As font packages are often reverse dependent on another packages, watch the list closely to detect whether or not some additional packages are about to remove. This command is safe - it will ONLY print what is to be done. If there are any packages, like libreoffice or xreader, you will have to force system to remove ONLY specified packages, which WILL break the consistency of the package system and could be dangerous. However, we are about to remove only some font packages, so no real harm could be done.

To remove ONLY specified packages and IGNORE all broken dependencies and requirements of other installed packages, run the command:

sudo dpkg --remove --force-all --dry-run `cat not-needed-font-packages.txt`  

This command WILL ignore all errors, but will print them, to allow you to understand what will be slightly broken. If you upgrade the system and some of reverse dependencies will be reinstalled, it is possible that those font packages will be installed again, but who cares.

To finally remove unnecessary packages, remove --dry-run option, and run the final command:

sudo dpkg --remove --force-all `cat not-needed-font-packages.txt`  

Note, that on your system the situation could be different. On my Linux Mint 18.3 Cinnamon workstation all specified packages were removed and the log looked like this:

(Odczytywanie bazy danych ... 269043 pliki i katalogi obecnie zainstalowane.)  Usuwanie pakietu fonts-beng (2:1.2) ...  Usuwanie pakietu fonts-beng-extra (1.0-5) ...  Usuwanie pakietu fonts-deva (2:1.2) ...  Usuwanie pakietu fonts-deva-extra (3.0-3) ...    ... lots of another lines like this...    Usuwanie pakietu fonts-lohit-taml-classical (2.5.3-2) ...  Usuwanie pakietu fonts-lohit-telu (2.5.3-1) ...  Usuwanie pakietu fonts-samyak-taml (1.2.2-4) ...  dpkg: fonts-noto-hinted: problemy z zależnościami, usuwanie według żądania:   fonts-noto zależy od fonts-noto-hinted.    Usuwanie pakietu fonts-noto-hinted (20160116-1) ...  dpkg: fonts-opensymbol: problemy z zależnościami, usuwanie według żądania:   libreoffice-core zależy od fonts-opensymbol.   libreoffice-math zależy od fonts-opensymbol.    Usuwanie pakietu fonts-opensymbol (2:102.7+LibO5.1.4-0ubuntu1) ...  dpkg: fonts-symbola: problemy z zależnościami, usuwanie według żądania:   ttf-ancient-fonts-symbola zależy od fonts-symbola.    Usuwanie pakietu fonts-symbola (2.59-1) ...  dpkg: fonts-mathjax: problemy z zależnościami, usuwanie według żądania:   libjs-mathjax zależy od fonts-mathjax (>= 2.6.0~).    Usuwanie pakietu fonts-mathjax (2.6.1-1) ...  Przetwarzanie wyzwalaczy pakietu fontconfig (2.11.94-0ubuntu1.1)...  

After that, I have the system with ONLY fonts I like. You can check what font packages remained using this simple command:

dpkg -l fonts\*|grep ^ii|awk '{print $2}'  

The result:

fonts-dejavu  fonts-dejavu-core  fonts-dejavu-extra  fonts-freefont-ttf  fonts-hack-ttf  fonts-liberation  fonts-noto  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »