Rebuild Font Cache on Linux

When you add fonts, for instance to your ~/.fonts folder, you’ll need to force rebuild the font cache.

Help docs

fc-cache --help
Build font information caches in [dirs]
(all directories in font configuration by default).
    -f, --force              scan directories with apparently valid caches
    -v, --verbose            display status information while busy

Rebuild

We can force it to re scan the valid caches to find our new fonts.

➜ fc-cache -f -v
Font directories:
    /usr/share/fonts
    /usr/local/share/fonts
    /home/rockerboo/.config/local/share/fonts
    /home/rockerboo/.fonts
    /usr/share/fonts/100dpi
    /usr/share/fonts/75dpi
    /usr/share/fonts/OTF
    /usr/share/fonts/TTF
    /usr/share/fonts/adobe-source-code-pro
    /usr/share/fonts/cantarell
    /usr/share/fonts/encodings
    /usr/share/fonts/gnu-free
    /usr/share/fonts/gsfonts
    /usr/share/fonts/liberation
    /usr/share/fonts/nerd-fonts
    /usr/share/fonts/noto
	/usr/share/fonts/tex-gyre
    /usr/share/fonts/util
    /usr/share/fonts/wenquanyi
    /home/rockerboo/.fonts/otf
    /home/rockerboo/.fonts/public-sans
    /usr/share/fonts/encodings/large
    /usr/share/fonts/wenquanyi/wqy-zenhei
    /home/rockerboo/.fonts/public-sans/otf
    /usr/share/fonts: caching, new cache contents: 0 fonts, 15 dirs
    /usr/share/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs
    /usr/share/fonts/75dpi: caching, new cache contents: 398 fonts, 0 dirs
    /usr/share/fonts/OTF: caching, new cache contents: 14 fonts, 0 dirs
    /usr/share/fonts/TTF: caching, new cache contents: 304 fonts, 0 dirs
    /usr/share/fonts/adobe-source-code-pro: caching, new cache contents: 30 fonts, 0 dirs
    /usr/share/fonts/cantarell: caching, new cache contents: 11 fonts, 0 dirs
    /usr/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
    /usr/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
    /usr/share/fonts/gnu-free: caching, new cache contents: 12 fonts, 0 dirs
    /usr/share/fonts/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
    /usr/share/fonts/liberation: caching, new cache contents: 12 fonts, 0 dirs
    /usr/share/fonts/nerd-fonts: caching, new cache contents: 24 fonts, 0 dirs
    /usr/share/fonts/noto: caching, new cache contents: 1 fonts, 0 dirs
    /usr/share/fonts/tex-gyre: caching, new cache contents: 33 fonts, 0 dirs
    /usr/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
    /usr/share/fonts/wenquanyi: caching, new cache contents: 0 fonts, 1 dirs
    /usr/share/fonts/wenquanyi/wqy-zenhei: caching, new cache contents: 3 fonts, 0 dirs
    /usr/local/share/fonts: skipping, no such directory
    /home/rockerboo/.config/local/share/fonts: skipping, no such directory
    /home/rockerboo/.fonts: caching, new cache contents: 0 fonts, 2 dirs
    /home/rockerboo/.fonts/otf: caching, new cache contents: 18 fonts, 0 dirs
    /home/rockerboo/.fonts/public-sans: caching, new cache contents: 20 fonts, 1 dirs
    /home/rockerboo/.fonts/public-sans/otf: caching, new cache contents: 18 fonts, 0 dirs
    /usr/share/fonts/100dpi: skipping, looped directory detected
    /usr/share/fonts/75dpi: skipping, looped directory detected
    /usr/share/fonts/OTF: skipping, looped directory detected
    /usr/share/fonts/TTF: skipping, looped directory detected
    /usr/share/fonts/adobe-source-code-pro: skipping, looped directory detected
    /usr/share/fonts/cantarell: skipping, looped directory detected
    /usr/share/fonts/encodings: skipping, looped directory detected
    /usr/share/fonts/gnu-free: skipping, looped directory detected
    /usr/share/fonts/gsfonts: skipping, looped directory detected
    /usr/share/fonts/liberation: skipping, looped directory detected
    /usr/share/fonts/nerd-fonts: skipping, looped directory detected
    /usr/share/fonts/noto: skipping, looped directory detected
    /usr/share/fonts/tex-gyre: skipping, looped directory detected
    /usr/share/fonts/util: skipping, looped directory detected
    /usr/share/fonts/wenquanyi: skipping, looped directory detected
    /home/rockerboo/.fonts/otf: skipping, looped directory detected
    /home/rockerboo/.fonts/public-sans: skipping, looped directory detected
    /usr/share/fonts/encodings/large: skipping, looped directory detected
    /usr/share/fonts/wenquanyi/wqy-zenhei: skipping, looped directory detected
    /home/rockerboo/.fonts/public-sans/otf: skipping, looped directory detected
    /var/cache/fontconfig: not cleaning unwritable cache directory
    /home/rockerboo/.config/cache/fontconfig: cleaning cache directory
    /home/rockerboo/.fontconfig: not cleaning non-existent cache directory

fc-cache: succeeded

Now your fonts will be in your font cache. Allow them to show up properly in the font list of various programs. You may need to restart a program to get it to populate in their font index.