Skip to content

Commit 2028f6c

Browse files
committed
Add List All Fonts On Your Machine as a Unix TIL
1 parent 1f039a8 commit 2028f6c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1576 TILs and counting..._
13+
_1577 TILs and counting..._
1414

1515
See some of the other learning resources I work on:
1616
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -1545,6 +1545,7 @@ See some of the other learning resources I work on:
15451545
- [Killing A Frozen SSH Session](unix/killing-a-frozen-ssh-session.md)
15461546
- [Last Argument Of The Last Command](unix/last-argument-of-the-last-command.md)
15471547
- [Less With Style](unix/less-with-style.md)
1548+
- [List All Fonts On Your Machine](unix/list-all-fonts-on-your-machine.md)
15481549
- [List All The Enabled ZSH Options](unix/list-all-the-enabled-zsh-options.md)
15491550
- [List All Users](unix/list-all-users.md)
15501551
- [List Files In A Single Column](unix/list-files-in-a-single-column.md)
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# List All Fonts On Your Machine
2+
3+
In trying to figure out what _FiraCode_ font I have installed on my machine
4+
and what it is called, I came across [this StackOverflow
5+
answer](https://stackoverflow.com/a/52789662/535590) which shares the
6+
following one-liner:
7+
8+
```bash
9+
$ fc-list | awk '{$1=""}1' | cut -d: -f1 | sort | uniq
10+
```
11+
12+
This uses `fc-list` to get the names of all the fonts available on your
13+
machine. This seems to work on both Linux and Mac. Through a series of `awk`,
14+
`cut`, and `sort | uniq`, this command produces a clean, easily-browsed list
15+
of fonts.
16+
17+
I like to take this a step further by piping it all to `fzf` where I can then
18+
narrow down the output to just lines that match _FiraCode_.
19+
20+
```bash
21+
$ fc-list | awk '{$1=""}1' | cut -d: -f1 | sort | uniq | fzf
22+
```
23+
24+
See also [`system_profiler SPFontsDataType`](https://apple.stackexchange.com/questions/35852/list-of-activated-fonts-with-shell-command-in-os-x/243746#243746).

0 commit comments

Comments
 (0)