I finally reached the point where I’m comfortable using the terminal for most things on my Linux computer. No longer a beginner, I ventured into learning even more about the Linux system, diving deeper into Bash. For example, I discovered you can customize the appearance of the terminal, add your own variables, and much more.
To start small, I decided to change the font family. Here’s how I did it.
A quick note before we start: I’m on Pop!_OS, which now ships its own terminal app called cosmic-term, part of the COSMIC desktop environment. That matters, because the way you apply a font to your terminal is specific to whichever terminal emulator you’re running. Cosmic-term doesn’t work the same way GNOME Terminal (the default on regular Ubuntu and Linux Mint) does. So while the font installation steps below will work on basically any Linux distro, the last step, actually setting the font, is Pop!_OS/COSMIC-specific. If you’re on Ubuntu or Mint, the method is different, and I may cover that in a separate post.
Every step in this tutorial uses the terminal instead of the GUI. Like I said: if I’m going to become a Linux power-user, then I need to stick with Bash.
Step 1: Installing a new font
Step 1a: Find a font
You can choose any font family you prefer. I recommend checking out Nerd Fonts. They have a great selection of mono-style fonts perfect for the terminal. I opted for MesloLG Nerd Font. Whichever font you prefer, right click on the download button and copy the link.
Step 1b: Download the font
Next, we have to download the font files and place them in a specific directory. Befn over to your terminal and let’s see where your fonts are currently saved. Type infc-list. You should see something similar to this:
username@hostname:~$ fc-list /usr/share/fonts/truetype/noto/NotoSerifKannada-Bold.ttf: Noto Serif Kannada:style=B
/usr/share/fonts/truetype/noto/NotoLoopedLao-Bold.ttf: Noto Looped Lao,Noto Looped Lao Bold:style=Bold /usr/share/fonts/truetype/noto/NotoSansGlagolitic-Regular.ttf: Noto Sans Glagolitic:
/usr/share/fonts/truetype/ubuntu/Ubuntu[wdth,wght].ttf: Ubuntu:style=Condensed Bold /usr/share/fonts/opentype/urw-base35/NimbusRoman-Italic.otf: Nimbus Roman:style=Ital
/usr/share/fonts/opentype/fira/FiraSansCondensed-SemiBoldItalic.otf: Fira Sans Condensed,Fira Sans Condensed SemiBold:style=SemiBold Italic,Italic /usr/share/fonts/opentype/fira/FiraSansCompressed-ExtraBold.otf: Fira Sans Compresseold:style=ExtraBold,Regular
/usr/share/fonts/truetype/noto/NotoSansNabataean-Regular.ttf: Noto Sans Nabataean:style=Regular username@hostname:~$
As you can see, the default fonts that come with Pop!_OS are in /usr/share/fonts. No, DON’T MESS WITH THAT FOLDER!
Of course, you could put new fonts in there, but in my experience, messing with systks things when you don’t know what you’re doing. Instead, I learned there is almostalways a user folder in your home directory associated with whatever setting or object you wish to add or modify.
So where should you install the new font? The folder you want to download the new font family to is /home/username/.local/share/fonts. It’s likely that the /fonts directory doesn’t exist yet but /home/username/.local/share should. Follow these commands to verify.
username@hostname:~$ ls /home/username/.local/share
**applications** **evolution** **gstreamer-1.0** **man** 'session_migration-(null)'
**pipx** **flatpak** **gvfs-metadata** **mime** recently-used.xbel
**pop-transition** **color-schemes** **keyrings** **nano** **Trash**
Don’t worry if your output doesn’t look exactly like mine. The only thing you need to focus on is if there’s a folder called fonts. If the fonts directory doesn’t exist, create it like this:
username@hostname:~$ mkdir /home/username/.local/share/fonts
Feel free to run that same ls /home/username/.local/share command again and verify the fonts folder shows up. When you’re done that, it’s time to download the font. Make sure you still have that link copied from step 1. I’ll break down the command after the terminal block below.
For downloading the entire font family in a zip file, use this command:
username@hostname:~$ wget -P ~/Downloads/ https://yourfontdownloadlink.com/FontName.e/.local/share/fonts/FontName ~/Downloads/FontName.zip && rm ~/Downloads/FontName.zip
Breaking down the commands
wget: the command to download files from the web-P: a wget option to save files to a specific prefix or folder~/Downloads: the actual location we want the file to download tohttps://yourfontdownloadlink.com/FontName.zip: the link to the zip file of the font you want. Make sure it ends in .zip&&: logically stands for AND_IF, meaning run the first command and if that command ran successfully, run this next commandunzip: the default unzip command in Bash-d: an unzip option to extract the files into a different or specific directory/home/username/.local/share/fonts/FontName: the new directory we want the extracted font files (or individual font file) located~/Downloads/FontName.zip: the location and file name of the zip file&&: we have one last command to runrm: delete a file~/Downloads/FontName.zip: the specific file to delete
# use this command if you want to download a specific .ttf file instead of the entire font family zip file:
username@hostname:~$ wget -P /home/username/.local/share/fonts/FontName https://your.ttf
Explanation of command
Since this is a single file instead of a zipped folder, we only need one command. Let me break it down:
wget: the command to download files from the web-P: a wget option to save files to a specific prefix or folder/home/username/.local/share/fonts/FontName: the actual location we want the file tohttps://yourfontdownloadlink.com/FontName.ttf: the link to the .ttf file of the font you want. Make sure it ends in .ttf
Step 2: Cache the new fonts in your home directory
You may need to run one final command to be able to use your newly downloaded font.
username@hostname:~$ fc-cache -rv
Explanation of command
fc-cache: tells Linux to scan the font directories and build an updated font cache for applications to use-rv: the r stands for really force and erases all the existing cache files and rescand will output details during the process
Step 3: Verify your font is in the updated cache
Run the command we ran in Step 1b one last time to ensure the cache rescan detected your new font.
username@hostname:~$ fc-list
/home/username/.local/share/fonts/FontName/FontName-Regular.ttf: Font Name:style=Regular
/home/username/.local/share/fonts/FontName/FontName-Bold.ttf: Font Name:style=Bold
/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf: Noto Sans:style=Regular
/usr/share/fonts/truetype/noto/NotoSansHebrew-Bold.ttf: Noto Sans Hebrew:style=Bold
/usr/share/fonts/truetype/noto/NotoSansSoraSompeng-Bold.ttf: Noto Sans Sora Sompeng:style=Bold
Notice the /home/username/.local/share/fonts directory shows up in the list now, and your font’s exact name (the part after the colon) is listed too. Write that name down; you’ll need it exactly as written for the next step.
Step 4: Setting the font in cosmic-term
Downloading and caching the font is only half the job. Pop!_OS’s terminal still doesn’t know to actually use it. cosmic-term doesn’t use gsettings like GNOME Terminal does. Instead, COSMIC apps store their settings as individual plain-text config files under ~/.config/cosmic/, using a format called RON. Since we’re staying out of the GUI, we can set the font by writing directly to that config file.
First, take a look at what’s already there:
username@hostname:~$ find ~/.config/cosmic/com.system76.CosmicTerm -type f
/home/username/.config/cosmic/com.system76.CosmicTerm/v1/profiles
By default, only a profiles file exists. COSMIC only writes a config file once you’ve changed a setting away from its default. The font is set with a separate font_name file, which doesn’t exist yet on a fresh install. We’ll create it ourselves.
username@hostname:~$ printf '"Font Name Here"' > ~/.config/cosmic/com.system76.CosmicTerm/v1/font_name
Breaking down the command
printf '"Font Name Here"': outputs the font’s exact name, wrapped in double quotes. COSMIC stores string values in this quoted format, confirmed by checking how other COSMIC apps store their owntext settings>: redirects that output into a file instead of printing it to the screen~/.config/cosmic/com.system76.CosmicTerm/v1/font_name: the config file cosmic-term reads to determine which font to use
Use the exact font name from your fc-list output in Step 3. For me, that was MesloLGS Nerd Font Mono.
Step 5: Open a new terminal window
The font doesn’t change in your currently open terminal window. cosmic-term only reads its config when a new window is created, so close your terminal and reopen it. Your new font should be there waiting for you.
Congrats! Now you can use a custom font in your Pop!_OS terminal, entirely from Bash. No digging through Settings menus required.
It’s a small thing, changing a font, but there’s something satisfying about it. A few years ago when I was a network engineer, I customized my SecureCRT terminal to get that black-background, green-text look just right, mostly because it made the terminal feel like mine. Changing the font in Cosmic terminal feels like the same thing now, on my own Linux box, entirely from Bash instead of clicking through menus, scratches the same itch. It’s a small step, but it’s the kind of small step that makes me want to keep digging into what else this system can do.
