16

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.

schaiba
  • 7,493
  • 1
  • 33
  • 31
jcubic
  • 9,612
  • 16
  • 54
  • 75

2 Answers2

37

Have you tried ?

fc-list | grep -i "media"

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

SHW
  • 14,454
  • 14
  • 63
  • 101
2

fc-list FontName file

where FontName is the exact font name found with

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

Alexander Shcheblikin
  • 1,768
  • 1
  • 14
  • 16
  • This is exact answer as accepted one. – jcubic Dec 26 '18 at 09: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. – Alexander Shcheblikin Dec 26 '18 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 Dec 27 '18 at 15:44
  • Portable 1-liner (w/ extra, automating steps). `fc-list $(fc-list|grep -i |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/: $//'` – bballdave025 Dec 24 '21 at 21:29