How to install fonts on Ubuntu

Install fonts on Ubuntu

In Ubuntu, many fonts are already installed in some cases, but sometimes other fonts may need to be installed. Or maybe you want to install Microsoft Fonts and Google Web Fonts for offline use or use your website.

Download and unzip optional fonts

Let’s see how to install True Type or Open Type fonts (.ttf, .otf, .ttc) in Ubuntu 18.04.

First, we need to download the fonts to be installed. In this tutorial, we will install on Ubuntu 18.04 using the Hack font. We will use cUrl to download the font with the following command:

Next, we will use tar to extract the files:

Now we can proceed to install the downloaded fonts.

Install fonts in Ubuntu Linux

Font files are usually installed in the system font directory on the path / usr / share / font /, or usually in the user font directory on one of the following paths: ~ / .local / share / font / or / usr / local / share / Font. In this example, we will use ~ / .local / share / fonts / path. If the directory does not exist, create it using the following command:

Now we will use the mv command to move the font to the destination folder:

Now you also have the option to delete the empty ttf folder and the downloaded archive:

Clear and regenerate font cache

Finally, we need to use fontconfig to process their fonts for the application and compile the font information cache:

If you get the following error, you need to install fontconfig verbosely first:

Use the following command to install fontconfig at both ends:

Type Y to continue.

Now we can proceed to rebuild the font cache:

From this terminal output, we can see that new fonts have been identified in the process.

Verify font installation

Confirm that the font is installed by using the fc-list command filtered on the font family name with grep to display the path and style definitions:

The font is now installed and ready to use.

Install fonts using the font manager

You can install downloaded fonts by double-clicking the font file.Gnome font viewerHere you can see the options for installing fonts in the upper right corner:

Font viewer

You can also install a font manager application and manage fonts in this way. To install the font manager in Ubuntu, open a terminal and use the following command:

sudo apt install gpart

You can view installed fonts here, as well as options for installing new fonts, removing existing fonts, and more.

To remove the font manager, use the following command:

Uninstall fonts on Ubuntu Linux

Now we will see how to uninstall these fonts. The uninstall process of the font includes the identification of the installation path, the deletion of the font binary file, and the regeneration of the font cache.

sudo apt install gparted

First, use the fc-list command with grep to identify the path where fonts are installed by family name:

Note: Modify the grep search term to identify other font families.

Now use the rm command to delete the installed font files on the path identified with the fc-list command:

Now regenerate the font cache using the following command:


In this tutorial, we learned how to manually manage fonts using the Ubuntu Linux command line, and how to manage them using GUI font tools. If you have any questions or comments, please post them below.