Well I did search through AskUbuntu and found some threads where people are asking about how can they install multiple fonts at once? I know the process. I have to copy-paste all the fonts, .ttf/.otf files inside of .font hidden folder and then rebuild the font cash via this command...

fc-cache -rv

This is crystal clear. I just want to know this...

I downloaded 10+ .zip font files. When I extracted the .zip folders I see within each folder there are couple of files. A readme file, a .ttf/.otf file and in some cases some variants of the fonts. Like bold.ttf, ultra_bold.ttf, semi_bold.ttf, black.ttf etc. I am not sure what these additional files are but I guess these are mainly variants of the core fonts. However my question is...

Do I need to extract all the .zip files manually and then copy only .ttf/.otf files and then paste them manually in .font folder? Or I can use a terminal command which will do everything on behalf of me. Here by the word everything I meant...

  1. Extracting the .zip files
  2. Copying only .ttf/.otf files
  3. Pasting only the .ttf/.otf files into .font folder
  4. Finally installing the .ttf/.otf files in Ubuntu

Sorry for asking a broad question. But to avoid down votes I had to make sure I am not asking anything which is asked before. And thanks in advanced for all your helps.

3 Answers 3


This is a one-liner in a terminal. Open a terminal with Ctr+Alt+T and run the commands below. Replace <your_font_zips> with the folder name, where you have placed your zip font files.

cd <your_font_zips>
# next command extracts all TTF and OTF files into your `.fonts` folder.
unzip "*.zip" "*.ttf" "*.otf" -d ${HOME}/.fonts
# next command rebuilds font cache
sudo fc-cache -f -v

If you want to remove the fonts again, then simply delete the TTF files in your .fonts folder and rebuild the font cache.

More about fonts and Ubuntu here.

And yes, you need all TTF files.

TTF and/or OTF

I quote:

OTF is more likely to be a “better” font, as it supports more advanced typesetting features (smallcaps, alternates, ligatures and so on actually inside the font rather than in fiddly separate expert set fonts). It can also contain either spline (TTF-style) or Bezier (PostScript Type 1-style) curves, so hopefully you're getting the shapes the font was originally designed in and not a potentially-poorer-quality conversion.


  • You put a different command few minutes ago! You mean I should run this one "unzip ".zip" ".ttf" "*.otf" -d ${HOME}/.fonts; sudo fc-cache -f -v" instead of the one you gave few minutes ago? Commented May 6, 2015 at 14:46
  • 1
    Yes, this is the final tested version =)
    – A.B.
    Commented May 6, 2015 at 14:52
  • We don't need the find
    – A.B.
    Commented May 6, 2015 at 14:52
  • don't forget to change the directory
    – A.B.
    Commented May 6, 2015 at 14:53
  • 1
    sudo fc-cache -f -v seems to load fonts from /root/.fonts not from ${HOME}/.fonts Commented Jan 9, 2022 at 0:24

Addendum to the accepted answer:

Run fc-cache -f -v without sudo.

If you use sudo, as indicated by the accepted answer, fc-cache will only process the root's fonts folder, while ignoring the user's fonts folder.


Not a one liner but here is slightly more robust script that works on Linux as well as OSX. Here we download codefonts and install it without overwriting existing files.

#fail if any errors
set -e
set -o xtrace

wget -P ${temp_dir} https://github.com/chrissimpkins/codeface/releases/download/font-collection/codeface-fonts.zip

if test "$(uname)" = "Darwin" ; then
  # MacOS
  # Linux
  mkdir -p $fonts_dir

# -n option avoids overwriting
set +e
unzip -n ${temp_dir}/codeface-fonts.zip "fonts/*.ttf" "fonts/*.otf" "*fonts/.pcf.gz" -d ${temp_dir}
set -e
cp -rnv ${temp_dir}/fonts ${fonts_dir}

if test "$(uname)" = "Darwin" ; then
  # Copy SF Mono for MacOS
  cp /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/*.otf "$fonts_dir/"

# Reset font cache on Linux
if which fc-cache >/dev/null 2>&1 ; then
    echo "Resetting font cache, this may take a moment..."
    fc-cache -f "$fonts_dir"

echo "codefonts installed to $fonts_dir"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .