Reinstall default truetype fonts (Ubuntu 16.04)

Just went through this with another user for a different directory. You can see what packages had files in a directory. In my case:

$ dpkg -S /usr/share/fonts/truetype | cut -sd: -f1 | tr -d , | fold -w80
fonts-opensymbol ttf-mscorefonts-installer ttf-ubuntu-font-family fonts-symbola 
fonts-liberation fonts-freefont-ttf fonts-droid-fallback fonts-dejavu-core

We can polish that up into a single command that just reinstalls all those packages:

sudo apt install --reinstall $(dpkg -S /usr/share/fonts/truetype | cut -sd: -f1 | tr -d ,)

The benefit here is you're reinstalling the files based on your packages.


I generated a list of the packages owning each directory in MY /usr/share/fonts/truetype. (I have not trashed my fonts). Reinstall (with sudo apt-get install --reinstall <package> <...>:

w3@aardvark:~(0)$ for i in /usr/share/fonts/truetype/* ; do
> dpkg -S $i
> done
fonts-sil-abyssinica: /usr/share/fonts/truetype/abyssinica
fonts-ancient-scripts, fonts-symbola: /usr/share/fonts/truetype/ancient-scripts
fonts-gfs-artemisia: /usr/share/fonts/truetype/artemisia
fonts-gfs-baskerville: /usr/share/fonts/truetype/baskerville
fonts-gfs-bodoni-classic: /usr/share/fonts/truetype/bodoni-classic
fonts-dejavu-extra, fonts-dejavu-core: /usr/share/fonts/truetype/dejavu
fonts-gfs-didot: /usr/share/fonts/truetype/didot
fonts-gfs-didot-classic: /usr/share/fonts/truetype/didot-classic
fonts-droid: /usr/share/fonts/truetype/droid
fonts-font-awesome: /usr/share/fonts/truetype/font-awesome
fonts-guru-extra: /usr/share/fonts/truetype/fonts-guru-extra
dpkg-query: no path found matching pattern /usr/share/fonts/truetype/fonts-japanese-gothic.ttf
fonts-freefont-ttf: /usr/share/fonts/truetype/freefont
fonts-gfs-gazis: /usr/share/fonts/truetype/gazis
fonts-sil-gentium: /usr/share/fonts/truetype/gentium
fonts-sil-gentium-basic: /usr/share/fonts/truetype/gentium-basic
fonts-horai-umefont: /usr/share/fonts/truetype/horai-umefont
fonts-kacst: /usr/share/fonts/truetype/kacst
fonts-kacst-one: /usr/share/fonts/truetype/kacst-one
fonts-lao: /usr/share/fonts/truetype/lao
fonts-lato: /usr/share/fonts/truetype/lato
fonts-liberation: /usr/share/fonts/truetype/liberation
fonts-lohit-guru: /usr/share/fonts/truetype/lohit-punjabi
fonts-lyx: /usr/share/fonts/truetype/lyx
dpkg-query: no path found matching pattern /usr/share/fonts/truetype/msttcorefonts
fonts-nanum: /usr/share/fonts/truetype/nanum
fonts-gfs-neohellenic: /usr/share/fonts/truetype/neohellenic
fonts-gfs-olga: /usr/share/fonts/truetype/olga
fonts-opendin: /usr/share/fonts/truetype/opendin
fonts-opensymbol: /usr/share/fonts/truetype/openoffice
fonts-sil-padauk: /usr/share/fonts/truetype/padauk
fonts-gfs-porson: /usr/share/fonts/truetype/porson
fonts-lklug-sinhala: /usr/share/fonts/truetype/sinhala
fonts-gfs-solomos: /usr/share/fonts/truetype/solomos
fonts-takao-pgothic: /usr/share/fonts/truetype/takao-gothic
fonts-gfs-theokritos: /usr/share/fonts/truetype/theokritos
fonts-tibetan-machine: /usr/share/fonts/truetype/tibetan-machine
fonts-tlwg-waree-ttf, fonts-tlwg-umpush-ttf, fonts-tlwg-typo-ttf, fonts-tlwg-typist-ttf, fonts-tlwg-typewriter-ttf, fonts-tlwg-sawasdee-ttf, fonts-tlwg-purisa-ttf, fonts-tlwg-norasi-ttf, fonts-tlwg-mono-ttf, fonts-tlwg-loma-ttf, fonts-tlwg-laksaman-ttf, fonts-tlwg-kinnari-ttf, fonts-tlwg-garuda-ttf: /usr/share/fonts/truetype/tlwg
ttf-bitstream-vera: /usr/share/fonts/truetype/ttf-bitstream-vera
ttf-dejavu-extra, ttf-dejavu-core: /usr/share/fonts/truetype/ttf-dejavu
ttf-indic-fonts-core: /usr/share/fonts/truetype/ttf-indic-fonts-core
ttf-marvosym: /usr/share/fonts/truetype/ttf-marvosym
ttf-xfree86-nonfree: /usr/share/fonts/truetype/ttf-xfree86-nonfree
ttf-ubuntu-font-family: /usr/share/fonts/truetype/ubuntu-font-family
fonts-unfonts-core: /usr/share/fonts/truetype/unfonts-core
ttf-unifont: /usr/share/fonts/truetype/unifont
fonts-wqy-microhei: /usr/share/fonts/truetype/wqy
w3@aardvark:~(0)$