How To Install TTF Fonts in Linux

I really like the Hack font – it’s used in my terminal apps on MacOS, Linux and even Windows workstations. This short post demonstrates how to install Hack font, but you can use the steps to configure any other TrueType Font (TTF) on your system.

Step 1: Download the TTF font files

In my case, I downloaded the Hack v3 ZIP archive.

Naturally, you need to unpack it:

greys@xps:~/Downloads $ unzip Hack-v3.003-ttf.zip 
Archive: Hack-v3.003-ttf.zip
creating: ttf/
inflating: ttf/Hack-Bold.ttf 
inflating: ttf/Hack-BoldItalic.ttf 
inflating: ttf/Hack-Italic.ttf 
inflating: ttf/Hack-Regular.ttf 
greys@xps:~/Downloads $

Step 2: Copy TTF files into local fonts directory

First you’re going to have to create it in your own homedir:

greys@xps:~/Downloads $ mkdir -p ~/.local/share/fonts 

Now let’s copy the font files into that local fonts directory:

greys@xps:~/Downloads $ ls ttf/* 
45-hack.conf Hack-BoldItalic.ttf Hack-Bold.ttf Hack-Italic.ttf Hack-Regular.ttf 
greys@xps:~/Downloads $ cp ttf/*ttf ~/.local/share/fonts/

Step 3: Refresh fonts cache with fc-cache command

Just run the fc-cache command like this:

greys@xps:~/Downloads $ fc-cache -f -v 

This command will show a list of fonts locations that it inspects and caches for system use. Among the lines of output you can see my home directory:

/usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/X11R6/lib/X11/fonts: skipping, no such directory
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/home/greys/.local/share/fonts: caching, new cache contents: 4 fonts, 0 dirs
/homee/greys/.fonts: skipping, no such directory
/usr/share/fonts/X11: skipping, looped directory detected

Step 4: Review available fonts

This should now report that your graphics system (X11/Xorg) has access, the list will include the newly installed fonts Hack:

greys@xps:~/Downloads $ fc-list | grep Hack
/storage/greys/.local/share/fonts/Hack-Regular.ttf: Hack:style=Regular 
/storage/greys/.local/share/fonts/Hack-Bold.ttf: Hack:style=Bold 
/storage/greys/.local/share/fonts/Hack-BoldItalic.ttf: Hack:style=Bold Italic 
/storage/greys/.local/share/fonts/Hack-Italic.ttf: Hack:style=Italic

That’s it! Since I wanted this Hack font specifically for terminal use, I went and updated my default profile in GNOME Terminal app:

Configure Linux Terminal to use Hack font

to enjoy the font:

screenfetch with Hack font

See Also

See Also




Keep Learning with Me

Follow me on Facebook and Twitter or jump into Telegram chat!:
I'm using Brave browser
Give it a try, it's awesome: Brave Browser
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
29 May 2020

How To: Fix apt update in Ubuntu 19.04

28 May 2020

Raspberry Pi 4 8GB

19 May 2020

Grafana 7.0 Released

Recent Tweets