Last week we dealt with how to install fonts in Windows and in MacOS. Now it’s time to hold Linux users’ hands as they learn how to install new fonts on their machines. In a way, installing fonts in Linux is similar to doing so on MacOS, since both operating systems allow users to install fonts system-wide or for a specific user only, but the two store font files in completely different directories.
Linux fonts folders
Fonts under Linux are normally stored under one (or both) of the following directories:
|/usr/share/fonts||Contains fonts that must be available to all users in the system. Despite its name, it does not only contain font files, but also some files required by the X11 Windowing System. It normally contains multiple folders named after the type of font file and their purpose. Only system administrators can edit the content of this folder.|
|~/.fonts||Contains fonts that are available only for the currently logged in user. Some distributions don’t create this folder by default. Only the owner (and administrators) can modify its contents.|
Mind the leading dot in the name of the .fonts directory: it means that that folder is hidden.
Note: Depending on your Linux distribution, this folder may not exist created by default. To check if it exists, open your file manager of choice and press the keyboard shortcut Ctrl + F to show hidden files and folders.
How to install fonts in Linux
Installing from the GUI
Installing through your distribution’s software manager
The current status of Linux software managers is that of a complete, total, utter anarchy. You may be happy to know, however, that most will list fonts under their own category. In our example, we’ll be using Linux Mint 17.3, but the process should be similar for all other distributions, including those not based on Ubuntu.
Open your software manager.
Note: You may need to enter your administration password.
Click on the Fonts category.
Click or double-click the font you want to install, then click the Install button.
Installing by dragging and dropping
It’s no mystery that Linux’ font selection is… rather paltry, to say the least. The fact that most font packages won’t let you preview their appearance is another major issue I have with installing fonts through package managers. For this reason, I think that the best way to get new fonts is to download them from the Internet and copy them to the fonts directory. Not to mention, installation of fonts by dragging and dropping allows you to choose whether you want to install fonts system-wide or for a specific user, whereas using your distribution’s software manager will install them for all users no matter what.
Installing for a single user
Open your file manager. It should open on your home folder. If it doesn’t, browse your file system until you reach it and press the keyboard shortcut Ctrl + H. This will show hidden files therein. We want to know if the .fonts folder exist.
In our example, it doesn’t exist, so we’ll have to create it manually by right-clicking somewhere empty and selecting Create new folder. Name it .fonts and press Enter to confirm.
Now, you may open that folder and drag the desired font file in there. You should test if the font file is actually usable already. Open an application that supports multiple fonts, like LibreOffice Writer, and search for it in the font box. If it doesn’t, log out of your session and log back in.
Installing for all users
Since only root can write to the /usr/share/fonts folder, we will need to open it with superuser privileges. To do this, open the Terminal and use the following command:
sudo xdg-open /usr/share/fonts
You will be required to enter your password. Now that the file manager is open on the right path, drag and drop your files to install them.
Note: Even though /usr/share/fonts contains subfolders, you’re not required to copy font files in the correct subfolder in order to install them.
Installing through the command line
Installing for the current user
Open the Terminal after you’ve made sure that you know where the files you want to install are stored. In our example, they will be in ~/Downloads/fonts. Use the command
to make sure that .fonts exists. If it doesn’t, create it by using
Pro-tip: You can shorten the process by using the command
ls ~./fonts || mkdir ~/.fonts
This will check if .fonts exists and, if it doesn’t, will create it, otherwise it’ll do nothing after the check.
cp command to copy its content to the .fonts directory, like this:
cp ~/Downloads/fonts/* ~/.fonts
Alternatively, you may use mv to move them
mv ~/Downloads/fonts/* ~/.fonts
Installing for all users
This is similar to what we’ve described above, with the exception that /usr/share/fonts is guaranteed to exist, which means that we can safely ignore the steps to ensure its existence. Remember that only root can install fonts system-wide, so we’ll have to use sudo.
As above, our example font files are in ~/Downloads/fonts.
sudo cp ~/Downloads/fonts/* /usr/share/fonts
sudo mv ~/Downloads/fonts/* /usr/share/fonts
If you’ve found this article helpful, why not leaving us a like on Facebook and telling your friends about Tech 4 Freelancers?