18

I have a font with the name Media Gothic. How can I find the file name of that font in Linux? I need to copy that file to another system. I've tried:

find /usr/share/fonts/ -name '*media*'

But this gives no results. gothic gives some other fonts. TTF is a binary format so I can't use grep.

2 Answers 2

40

Have you tried ?

fc-list | grep -i "media"

Also give a try to fc-scan, fc-match

3
  • 1
    Didn't know about fc-* commands. Thanks.
    – jcubic
    Commented Apr 7, 2014 at 11:22
  • 3
    How does this help locate the actual font file? The font file name might be (at best) a scrambled version of the actual font name. Commented Aug 11, 2017 at 9:54
  • yes it does list the font name and the (sometimes scrambled) filename
    – ahofmann
    Commented Jun 7, 2020 at 18:24
4

fc-list FontName file

where FontName is the exact font name found with

fc-list | grep -i approximate-or-partial-font-name

4
  • This is exact answer as accepted one.
    – jcubic
    Commented Dec 26, 2018 at 9:40
  • On newer systems - yes, but on older ones fc-list withouth the file command does not show filenames for the fonts listed. And the file command could only be specified after a FontName. Commented Dec 26, 2018 at 15:30
  • You should mention that in answer, that on older system accepted answer don't show files names and you need to call fc-list again to get the filename.
    – jcubic
    Commented Dec 27, 2018 at 15:44
  • Portable 1-liner (w/ extra, automating steps). fc-list $(fc-list|grep -i <apprx-part-font-name>|head -n 1|awk '{print $NF}') file|sed 's/: $//'. e.g., Unifont; steps - in: $ fc-list|grep -i unifont, out: 1st of 3 lines: /usr/share/fonts/unifont-fonts/unifont-14.0.01.ttf: Unifont:style=Regular'.Just name - in: $ fc-list|grep -i unifont|head -n1|awk '{print $NF}', out: Unifont:style=Regular.Answer above - in: $ fc-list $(fc-list|grep -i unifont|head -n 1|awk '{print $NF}') file, out: /usr/share/fonts/unifont-fonts/unifont-14.0.01.ttf: Lose colon w/ pipe to sed 's/: $//' Commented Dec 24, 2021 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .