As the inaugural post of the WordPressified blog, we’re going to look at xlsfonts.

Xlsfonts is part of the “apps” group in the modular Xorg system. It is one of the very few examples of an entirely-CLI application that is nonetheless an X client. The purpose of xlsfonts is to output a list of the fonts available to the X server.


As an X client, xlsfonts takes the -d and -display options to specify the display (generally the $DISPLAY environment variable will provide that). It also takes the near-universal -v option to print version information and exit.

The remaining options it takes are uncommon and so worth looking at. The options -l, -ll, and -lll add verbosity to the output. (No l’s means just the fonts names, -l means name and attributes, -ll means names, attributes, and properties, and -lll means names, attributes, properties, and character metrics.) The option -m, which can only be used with one of the -l options, add minimum and maximum bounds to the font information.

The -n option tells xlsfonts to output to multiple columns (this sort of thing is considered in bad taste nowadays; you should just pass the user output which she can then pipe to her own columnizing utility, but this command’s pedigree is ancient so they kept this). -n 2 means 2 columns, -n 3 means 3 columns, etc. -n 0 means as many columns as possible (see below). -C is the same as -n 0, and -1 is the same as -n 1.

Speaking of columns, -w tells xlsfonts how many characters wide its output can be; it defaults to 79. If -n, -C, or -1 are not specified, xlsfonts prints as many columns will fit in the number specified by -w, or 79 if -w is also not specified.

-u means the output should not be sorted (by default it is; again, that’s considered bad taste by today’s programming standards). -fn pattern only lists fonts matching the string pattern (this is not a regex, just a literal case-sensitive string match).


Leave a Reply

Your email address will not be published. Required fields are marked *