fc-cache Command in Linux

This tutorial explains Linux “fc-cache” command, options and its usage with examples.

fc-cache — build font information cache files

DESCRIPTION

fc-cache scans the font directories on the system and builds font information cache files for applications using fontconfig for their font handling. If directory arguments are not given, fc-cache uses each directory in the current font configuration. Each directory is scanned for font files readable by FreeType. A cache is created which contains properties of each font and the associated filename. This cache is used to speed up application startup when using the fontconfig library.

SYNOPSIS

fc-cache [ -fsvVh ] [ –force ] [ –system-only ] [ –verbose ] [ dir… ]

OPTIONS

advertisement
advertisement

-f
Force re-generation of apparently up-to-date cache files, overriding the timestamp checking.
-s
Only scan system-wide directories, omitting the places located in the user’s home directory.
-v
Display status information while busy.
dir
Directory to scan for fonts.

EXAMPLES

1. Once you have your handy collection of True Type fonts, you are going to want to create a directory to hold them. Installing the fonts system-wide will give all users access to them. First, create a font directory in /usr/share/fonts/truetype. Call this directory newfonts. Issue the command sudo mkdir /usr/share/fonts/truetype/newfonts. You will have to enter your sudo password to complete this task.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

Once this directory is created, place all your *ttf or *TTF files in the newfonts directory. With the fonts in place you will then need to issue the command

# fc-cache -f -v

to make the system aware of the new fonts. Once this is done, the system knows about the new fonts and all the system users will have access to them.

2. If you want to make these fonts available only to specific users, then you will follow the same directions except you will add the fonts only to the users’ ~/.fonts directory. If the ~/.fonts directory doesn’t exist, create it with mkdir ~/.fonts (while logged into the specific users’ accounts). Now move (or copy) all of the *ttf and/or *TTF files into the new directory and run

advertisement
# fc-cache -f -v

to make the users’ accounts aware of the fonts.

If you have a single-user machine, go with the latter version.

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

advertisement
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.