Linux – Quickly list all available fonts

last updated in Categories Linux, News, X server

Brief: This article shows you how to use fc-list command in Linux to get list of available fonts.

Have you ever wondered how to find all available fonts on your Linux system? Fear not. Try fc-list command. It is a quick and handy command to lists fonts and styles available on the Linux system for applications using fontconfig. You can use fc-list to find out whether a particular language font is installed or not.

List all available fonts on Linux using the CLI

Open the terminal application. To list all font faces, run:
$ fc-list
Use the more command as pager or grep command/egrep command to search for fonts:
$ fc-list | more
$ fc-list | grep -i "word"
$ fc-list | grep -i UbuntuMono

Quickly list all available fonts
To lists font faces that cover Hindi language:
$ fc-list :lang=hi
Sample outputs:

Samanata:style=Regular
Gargi_1.7:style=Medium
FreeSans:style=Medium,navadno
Chandas:style=Regular
Lohit Hindi:style=Regular
/usr/share/fonts/truetype/freefont/FreeSansBold.ttf: FreeSans:style=Bold,получерен,negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,gros,Полужирный,Fet,Kalın,huruf tebal,жирний,Krepko,treknraksts,pusjuodis,đậm,Lodia,धृष्ट
/usr/share/fonts/truetype/freefont/FreeSans.ttf: FreeSans:style=Regular,нормален,Normal,obyčejné,Mittel,µεσαία,Normaali,Normál,Medio,Gemiddeld,Odmiana Zwykła,Обычный,Normálne,menengah,прямій,Navadno,vidējs,normalusis,vừa,Arrunta,सामान्य
/usr/share/fonts/truetype/Sarai/Sarai.ttf: Sarai:style=Regular
/usr/share/fonts/truetype/lohit-devanagari/Lohit-Devanagari.ttf: Lohit Devanagari:style=Regular
/usr/share/fonts/truetype/freefont/FreeSerif.ttf: FreeSerif:style=Regular,нормален,normal,obyčejné,Mittel,µεσαία,Normaali,Normál,Normale,Gemiddeld,odmiana zwykła,Обычный,Normálne,ปกติ,menengah,прямій,Navadno,vidējs,normalusis,عادی,vừa,Arrunta,सामान्य
/usr/share/fonts/truetype/samyak/Samyak-Devanagari.ttf: Samyak Devanagari:style=Regular
/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf: FreeSerif:style=Bold,получерен,negreta,tučné,fed,Fett,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,gros,Обычный,Fet,ตัวหนา,Kalın,huruf tebal,жирний,Polkrepko,treknraksts,pusjuodis,ضخیم,đậm,Lodia,धृष्ट
/usr/share/fonts/truetype/Gargi/Gargi.ttf: Gargi,गार्गी:style=Regular,गार्गी
/usr/share/fonts/truetype/fonts-deva-extra/chandas1-2.ttf: Chandas:style=Regular
/usr/share/fonts/truetype/Sahadeva/sahadeva.ttf: Sahadeva:style=Regular
/usr/share/fonts/truetype/Nakula/nakula.ttf: Nakula:style=Regular
/usr/share/fonts/truetype/fonts-deva-extra/samanata.ttf: Samanata:style=Regular

Verbose output when listing fonts

Display verbose output of the whole font pattern for each match, or elements if any is provided as follows:
fc-list -v

Suppress all normal output

Pass the -q option to suppress all normal output. returns 1 as the exit status (error) code if no fonts matched. For example, look up for Waree font and if not found report it:

fc-list -q Waree
echo $?
fc-list -q WareeFooBar && echo "Font found" || echo "Font not found."
### search for Dyuthi font ###
f="Dyuthi"
fc-list -q "$f"
if [ $? -eq 0 ] 
then
    echo "Font $f found. The installation will continue..."
else
    echo "Font $f not found. The unstallation will abort..."
    exit 1
fi

See how to use if .. else .. if for more info. You can show version of the program and exit with the following option:
fc-list -V

Getting help

Read fc-list man page by typing the following man command:
man fc-list
Another option is to get list of options by passing the -h option to fc-list as follows:
fc-list -h
Sample outputs:

usage: fc-list [-vqVh] [-f FORMAT] [--verbose] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} 
List fonts matching [pattern]
 
  -v, --verbose        display entire font pattern verbosely
  -f, --format=FORMAT  use the given output format
  -q, --quiet          suppress all normal output, exit 1 if no fonts matched
  -V, --version        display font config version and exit
  -h, --help           display this help and exit

Conclusion

Fontconfig is a library for configuring and customizing font access. See the Fontconfig user manual online here for more information on commands and other options.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

1 comment

    Have a question? Post it on our forum!