1. Home
  2. Linux
  3. Preview fonts in the command line on linux

How to preview fonts in the command-line on Linux

Every Linux operating system has a lot of fonts preinstalled. Unfortunately, there is no built-in way to preview these fonts, and users have to resort to viewing them through various unofficial apps, many of which are confusing to use.

If you’re sick of using confusing tools to preview fonts, check out Fontpreview. It’s a command-line app that automatically detects what fonts are installed and lets you easily view them in a friendly text-based UI.

In this guide, we’ll go over how to set up the Fontpreview program on Linux. We’ll also go over how to use it to view all of the fonts on your system.

Installing Fontpreview on Linux

Getting the Fontpreview application installed on your Linux PC requires downloading the program from GitHub, as it is not in any mainstream software repositories. To start the installation process, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the step-by-step instructions below to get the app working.

Note: Using Arch Linux and don’t feel like manually installing the program? Point your favorite AUR helper at the fontpreview package to get it working.

Step 1: The first step in installing the Fontpreview app on Linux is to install the dependencies necessary to run the program successfully. Currently, you need Fontpreview requires Imagemagick, xdotool, fzf, and sxiv.

Ubuntu (19.10+)

sudo apt install imagemagick xdotool fzf sxiv

Debian (10 and Sid)

sudo apt-get install imagemagick xdotool fzf sxiv

Arch Linux

sudo pacman -S imagemagick xdotool fzfsxiv

Fedora

sudo dnf install imagemagick xdotool fzf sxiv

OpenSUSE

sudo zypper install imagemagick xdotool fzf sxiv

Generic Linux 

If you’re a Linux user and you’re using a distribution that is not one of the mainstream ones (Ubuntu, Debian, Fedora, etc.), you will need to download the dependencies manually. Head over to the project’s GitHub. It outlines the exact package names and can aide you in the setup process.

Step 2: After installing the Imagemagick dependency, it is time to download the latest release of Fontpreview to your Linux PC. Using the wget command, grab the software.

Note: Interaction with ZIP archive files requires the Unzip program. If your Linux system does not have Unzip installed (for some reason), you can find information on how to install it by clicking here.

wget https://github.com/sdushantha/fontpreview/archive/master.zip

Step 3: Once the master.zip file is done downloading, you will have all of the data necessary to install Fontpreview on your Linux PC. However, the software cannot be used until it is extracted from the master.zip file. To extract master.zip use the unzip command below.

unzip master.zip

Step 4: With the master.zip file extracted, you will see a folder with the name of the app in your home directory. To access this new folder, make use of the following CD command.

cd fontpreview-master

Take a look at the contents of the folder by executing the ls command.

ls

Step 5: Change the fontpreview binary file’s permissions so that your Linux PC can execute it. To change the permissions, use the chmod command below.

sudo chmod +x fontpreview

Step 6: Install the fontpreview binary file into the /usr/bin directory. Placing the file here will allow you to call it anywhere in the terminal as a regular program.

If you’re not comfortable placing the fontpreview binary file in /usr/bin, feel free to set it in a custom location and add it to your $PATH if you’re a Linux expert.

sudo mv fontpreview /usr/bin

With the fontpreview binary in the /usr/bin directory on your Linux PC, you will be able to access the Fontpreview program at any time by executing the command below.

fontpreview

Additionally, access information on the program by executing:

fontpreview --help

Previewing Linux fonts

Now that the fontpreview app is set up on your Linux PC, previewing installed fonts is possible. To view various fonts on your system, follow the step-by-step instructions below.

Step 1: Execute the fontpreview command in any open terminal window. This command will bring up the Fontpreview UI and also list all installed fonts on the system.

fontpreview

Step 2: Using the Up/Down Arrow keys on the keyboard, look for a font you would like to preview on the system. Once you’ve found the font to preview, press the Enter key. Fontpreview will then launch a display tool to show you the font.

Searching

The fontpreview app doesn’t just show you fonts in a list to pick from. You’ll also be able to search out the name of any font to preview it. To run a search on any font on your Linux system, do the following.

Step 1: Launch fontpreview in the terminal.

fontpreview

Step 2: Start typing out the name of the font you would like to preview in the app. It should instantly show up in the search results.

Step 3: Select the font in the list of search results with the Up/Down Arrow keys and press Enter to view it.

1 Comment

  1. I know another fontpreview package: https://github.com/MatteoGuadrini/fontpreview

    This is also a python package