I accidentally (recklessly) rm -rf my /usr/share/fonts/truetype directory. All my truetype fonts are gone now. :/ Is there anyway to get them back? I'm on Ubuntu 16.04.


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
  • Wouldn't it be more appropriate for the OP to just run dpkg -S /usr/share/fonts/truetype/ on their own system and use the results from that? – steeldriver Aug 2 '17 at 14:58
  • @steeldriver Isn't that precluded by the fact that O.P. did rm -rf /usr/share/fonts/truetype? – waltinator Aug 2 '17 at 15:01
  • 1
    Hmm... I've always understood that dpkg -S output is based on what the package database believes should be there? – steeldriver Aug 2 '17 at 15:06
  • @waltinator Are you on Ubuntu 16.04, too? – Glenn Mohammad Aug 2 '17 at 15:08
  • Yes, I'm on Ubuntu 16.04.3 LTS – waltinator Aug 2 '17 at 15:11

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.

  • Is this going to work even though I don't have the truetype directory itself anymore? – Glenn Mohammad Aug 2 '17 at 17:40
  • At no time in this command is there a need to access an actual /usr/share/fonts/truetype directory. dpkg keeps manifests for each installed package and uses that to determine what files are owned by what packages. – Chris Charabaruk Aug 2 '17 at 19:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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