 Recently, I've gotten a lot of new subscribers to the channel and many of these new subscribers are new to Linux users, so they're asking me some pretty basic questions about Linux and some of the questions that I've been getting regard fonts on Linux. How do you install fonts? How do you preview fonts? And they're also asking me about certain GUI font applications because they've read about it on certain blogs or they've heard about it in support form, so they're asking me about these particular GUI font applications that I've never actually used. I've never actually installed a font program on Linux for personal use. I've never done it. Why? It's because you actually don't need any of these programs to work with fonts on Linux because by default, your Linux installation already comes with all the tools that you need to install fonts and preview fonts. They're command line utilities, but they're there. You do have to open a terminal and use these applications in a terminal, but don't let that scare you. These tools are dead simple to use. And then once you learn how to use them, you don't have to worry about going and grabbing these third-party graphical applications. But before I move on to the command line applications, I will just briefly talk about a couple of the GUI applications people have asked me about. So apparently over at the OMG Ubuntu blog, they recently did an article about Font Manager, which is a GTK font application. And I don't know anything about this, but I thought, hey, they covered it and some of you guys read it and were asking me about the Font Manager. I would install it and check it out. And I've got to be honest, it is packaged in the AUR, the Arch user repository, because I use an Arch-based distro instead of an Ubuntu-based distro. Font Manager will not install from this AUR package. And I think I know the problem because looking at the package build for it, it hasn't been updated in a while and it's grabbing the source from GitHub and it's trying to use a tar.xz file. But now the AUR uses a different compression format. Now I think it tars all of these in a tar.zst format. So I think just simply changing that to the correct archived format would correct that. I'm not sure though I haven't actually tried it, but I just know trying to install it using Yay does not work. It will fill to build on my Arch-based distros. But the good thing is about these GUI font managers is there's a bunch of them on 1x and another very popular one that does install correctly on Arch is called Font Matrix. Font Matrix just lists all your fonts here. You know, I've got a bunch of fonts on my system. You just pick a font and it will tell you a little bit about it as far as the font type, character map, font boundary and all of that. You get some sample text, although the sample text is just... I don't know why they're using that particular sample text. Can you change that? You probably can. Anyway, you get the glyph layout, which shows you all of the characters. You have a playground layout where you could actually just start typing. So I could do, you know, the lazy brown... So the lazy brown dog jumped a fox once or whatever the heck that thing is that people love to type anyway. And you know, I could go down here and play with another font. Maybe I want to try Cocon or whatever the heck this font name is. And then I could also do the same thing down here, you know. And it actually has the other one that I did in the other font here in the playground, too, which is kind of cool. So you can actually compare fonts, you know, here in the font playground. By the way, you can drag these around. I'm kind of neat, of course, you know, in the menu system up here, you have some things like importing new fonts, exporting the fonts that are already on your system, syncing fonts. So that's a standard GUI application. But again, you don't need a graphical application to do any of this stuff. You can actually do all of this right at the terminal. So if I pull up a terminal and let me zoom in and clear the screen here. Now, all of your fonts on your system should be and slash user slash share slash font. So CD into slash user slash share slash fonts. And if you do an LS, there are all your fonts. Now, these are all folders. There's fonts within these folders. So you've got all these subdirectories, especially in the OTF directory here and the TTF directory. Let me CD into TTF. Well, it was all caps, though. Let me make sure I CD into the right name and then do an LS. And you see a whole bunch of fonts. So these are all the TTF fonts. Now, how do you install these things? Well, you simply go and grab these fonts somewhere off the internet. Go to Google fonts or any font collection website, the font dot com or wherever it is, you go to get your free fonts and go find your favorite free fonts and then place them in slash user slash share slash fonts and you can put it in some of the subdirectories. If it's a TTF extension, put it in that directory. That's an OTF extension. Put it in that directory. Let me pull up a graphical package manager because I think this will be easier to visualize if I go to user share fonts. And I go down here to the OTF directory and you can see I grab this particular font family here soup bone and it's got several different fonts. You know, it's got a regular and a bold and an italic and they were all in their own directory. I just left them in their own directory and through that whole directory into slash user slash share slash font slash OTF. That's fine. You can actually have as many subdirectories in this directory as you want, Linux handles that just fine. It will, it will search out all the fonts through this directory structure. So anyway, you go and grab your, your favorite fonts and you throw them in this directory somewhere. But just because you put it in this directory doesn't mean that those fonts are actually installed on the system. Those fonts are not installed on your system until you use a command line program called FC dash cash. And the command you need to run is with root privileges. You have to be sudo do sudo space FC dash cash space. And then give it these flags dash F space dash V. Give it those two flags. And you can actually combine that to just dash F V if you wanted in just one statement there. It's going to ask, of course, for the root password. So make sure you give it your root password and you see it scans the user share fonts directory, as well as some other directories that you could place fonts in. You can also place fonts in your home directory. There is a fonts directory that's available for you. I believe it's in dot local share fonts. But keep in mind, if you put your fonts in the directory that your distro uses for your home user, then that font will be available for your home user, but it won't be available system wide to all users on the machine. So I've just gotten in the habit to always put all of my fonts in slash user slash share slash fonts. That way they're available to everybody. So now that we've run the sudo FC dash cash dash FV command, you know, all these fonts have been installed. If I opened up Libre Office or Gimp or anything that I can use fonts in all of the fonts should be there. Now, what if you wanted to preview a font, right? Because I don't know what all these fonts are because that's what a lot of people use the GUI font applications for is simply previewing the font. Well, what you could do is navigate to your user share fonts directory. In this case, I'm in user share fonts, TTF, let me do an LS and you know, I can list out all the fonts. Maybe I want to specifically take a look at the space age font that I see listed. So maybe I could grip space and that will give me all the fonts that have space as part of the name and then the command to actually take a look at something as far as an image preview on Linux. There's a command line command called display. It actually uses image magic to display an image and these TTF files and OTF files are essentially images of these fonts. So I could do display and then just start typing space and then tab complete and it completes space age dot TTF and there it is. That is a nice little image preview. Let's see if I can adjust that kind of actually cool futuristic font there. I don't think I've actually used that one for anything. It's not very easy to read. I would probably wouldn't use that for like a YouTube thumbnail or anything, but a kind of cool sci fi looking font there. So no need to use any kind of graphical application to install fonts, right? Just run the pseudo FC dash cash demand. There's no reason to have a third party program to do something so simple now previewing the fonts. I know some of you are going to say, well, running that display command and then the path to the font that you want to preview. That's a little clunky. I agree. Wouldn't it be better if we could write some kind of script, maybe a D menu or a Rofi script that could do that for us. And yes, we could. I could probably write something in about three minutes that would search out my user share fonts directory, grab all the fonts, put them in a list that we could search through. And then I just click one and it displays that font. Now there are command line utilities that you can use to display the output of particular directories. Obviously LS would be one. I mean, I could LS recursively the user share fonts directory, but there is a built in command specifically for fonts. If you use FC dash list, that lists all the fonts on your system. Now, let me clear the screen here and let me get back to the FC dash list command. And, you know, that was too much information in that FC dash list command. So what I'm going to do is I'm going to pipe it through all and I'm going to ask it to print the first column because the first time it had the path to the font and then it also had the name of the font. I don't need the name of the font. I just need the path to the font because later when we use the display command, we need display space path to find the name is just useless information. So now that is a format we can actually use, except there's one problem with the path to these fonts at the very end. Do you notice there's a colon and that colon was a separator because you had the path to the font colon as a separator. And then the name of the font, I need to get rid of the colon. So what I'm going to do is take that last command and this time let's run it through Sid. Let's just do a quick substitution. So I think what I'm going to do is s or substitution here and we want to get rid of the colon and then slash and then whatever we want to replace the colon with. I don't want to replace the colon with anything. So I'm just going to leave that blank there and then we're just going to do another slash and then G for a global substitution and then a single quote at the end. So if you're not familiar with how Alk or Sid works, I do apologize. They're pretty simple utilities to get up to speed with. But what this should do is run that fc list command, take the first column and then it's going to find any colons within these paths and get rid of the colon. And now we just have the paths. And now we could actually have these run with the display command and actually get image previews. So what I want to do is run that last command one more time. And let's make sure it will actually work being piped into something like D menu. So I will pipe it into D menu and I'm going to give it this flag dash L for lines, vertical lines. We'll do 20 lines. And then I'm going to give it this dash P flag for prompt and we'll have the prompt say font viewer. I think that's descriptive enough. And there we have it. There is D menu and I could search through this list of fonts. And then I could choose a font whichever one I want. It doesn't matter because right now it doesn't do anything because this doesn't tell us what we're going to do on the click. Right. We took the list of everything and formatted it exactly right. We piped it into D menu. But what is D menu supposed to do with this stuff when we click? Well we want it to run the display command on it. But to do that what we need to do is really just go ahead and put this in a script. So what I'm going to do is I'm going to CD back into my home directory. I'm going to CD into a directory on my system that I created just for my D menu scripts called dot D menu. And let me run an LS here. And I created a script here called D menu dash font viewer. And let me go ahead and open that up. I'm going to open that up in Vim here. And I've got a header here. These are just comments to let me know what the script is. It's just going to be a quick and dirty script. But what I'm going to do is I'm going to create a variable here. I'm going to call it choice choice equals. And then we're going to do dollar symbol. And then parentheses here. The dollar symbol parentheses means everything within that is a shell command that I want you to run. What shell command do I want you to run. Well I want you to run exactly what I ran in the terminal here FC list. And then pipe that through all print the first column there. Then we're going to pipe all of that through said single quotes again. And again we're going to do the substitution where we substitute the colon for nothing. And we're going to pipe all of that into D menu. And we could do some different D menu flags. I mean if you don't want to do the vertical list you don't have to. If you wanted to you could center it in the screen. If you have D menu patch toward I actually do have D menu patch for that. I could center it in the screen. I could do the dash G flag for grid. And say I want you to do three columns. I could do the dash P flag again for the prompt. And this time I'm just going to simply do fonts. And we want it to run display. And then inside double quotes here I'm going to put the variable choice. So whatever we pick from the D menu is choice. Right. And then we want you to run display choice. That's right. And quit that. And now let me see if I can run that. There it is. There's our D menu that lists all of our fonts. It includes the full path of the font which is kind of unreadable because it's a long path because it's in user share fonts OTF or TTF. So these paths are kind of long. That's a little hard to work with. I know I have the hack font installed hack. I think this is the italic version. So if I choose it. There we go. We get a picture of hacks italics. Let me close that. So what I would do is I would go back into the script. The centering and the grid are not going to work because the paths are too long. I would just stick with the standard vertical listing not centered in the screen. I'm right and quit run it one more time. Yeah, that looks a lot better. That's pretty easy to read. And then I could search for any font such as the Ubuntu font. Maybe I want a Ubuntu medium. I think it's that one there. And there is the display of that. Now of course that was like a two minute script. This is not really much of a script. I could clean that up. I actually could clean that up to get rid of the extra stuff in the path. Like I don't need user share fonts, you know, in all the past. I could do some some different stuff with that if I really wanted to spend, you know, 1015 minutes and work with it. But just for, you know, something very basic. I think that would work for most people. There's no reason to go grab third party GTK applications like font manager or cute applications like font matrix, which I showed you by the way that is a cute application. There's no reason to go grab those kind of big heavy programs, those graphical programs, just to do the basic stuff that you can already do out of the box at the command line on Linux. Now before I go, I need to think a few special people I need to think the producers of the show, Devon Fran Gabe, Corbinian Mitchell, Akami, Archive 530 Chris Chuck, David, the other David Donnie, Dylan, Gregory Lewis, Paul, Pick VM, Scott and Willie, they're the producers of the show. They are my highest tiered patrons over on Patreon without these guys. This episode about working with fonts on Linux, it wouldn't have been possible. A show is also brought to you by each and every one of these fine ladies and gentlemen. All these names are saying on the screen, these are all my supporters over on Patreon because the Distro Tube channel has no corporate sponsors. It's sponsored by you guys, the community. And if you'd like to support my work, I'd greatly appreciate it. Please consider subscribing to Distro Tube over on Patreon. All right guys. Peace.