1. Overview

CHM files, or Compiled HTML Help files, are a proprietary Microsoft format for storing help documentation.

In this tutorial, we’ll see how to view CHM files in Linux. Specifically, we’re using Ubuntu 22.04 to demonstrate the chosen techniques.

2. CHM Files

CHM is a format typically used for software documentation, but can also be used for other types of documents, such as ebooks (electronic books) and user manuals. Furthermore, ebooks include text and graphics that may be distributed electronically and shown on-screen like traditional books.

Usually, software documentation and help tutorials around Windows products use .chm files. Moreover, these files are compressed using LZX algorithm to minimize their size. Also, the files may contain images besides HTML pages.

Although originally designed for Windows, there are tools available on Linux that can open and read CHM files.

3. Using CHM Readers

CHM files aren’t native to Linux, so there are a few different ways to view them. One way is to use a dedicated CHM reader application.

3.1. xCHM

xCHM is a free and open-source CHM reader available for many Linux distributions. It’s a fairly simple and easy-to-use graphical application.

Additionally, xCHM provides several basic features when it comes to CHM files:

  • browse contents
  • search for text
  • change text font and font size
  • print pages

Let’s install xCHM using apt:

$ sudo apt install xchm

After the installation is complete, we can open xCHM from the application menu. Alternatively, xCHM can also be opened by running the xchm command in a terminal:

$ xchm

Thus, we open the xCHM main window. We can then navigate to and open the CHM files using the File menu or by clicking the Open button:

xCHM main window

xCHM can handle CHM files, but it doesn’t support JavaScript in ebooks. Specifically, Javascript lets us add pages with interactive content.

3.2. Kchmviewer

For users who prefer the KDE desktop environment on Ubuntu, Kchmviewer is a great choice.

Let’s install Kchmviewer using apt:

$ sudo apt install kchmviewer

Once installed, we can launch Kchmviewer from the application menu or by running kchmviewer in the terminal:

$ kchmviewer

Let’s open our CHM files with Kchmviewer. For this, we can use either the File menu or the Open button:

Kchmviewer main window

Kchmviewer offers many features:

  • bookmarks functionality
  • search
  • non-English language support
  • EPUB format support

Also, Kchmviewer can correctly identify and display file encoding in CHM files.

3.3. Okular

Okular is a universal document viewer with many features:

  • supports Linux, Windows, Mac OS X, *BSD, and others
  • visualize Markdown documents
  • supports document formats like PDF, EPUB, CHM, DjVu, and others

Let’s install Okular:

$ sudo apt install okular -y

After installation, Okular can be launched from the application menu or right from the terminal:

$ okular

Again, the File menu can be used to access the local CHM files:

Okular main window

Okular is more feature-rich and versatile compared to xCHM and Kchmviewer.

4. Using Calibre

Calibre is a free and open-source ebook library manager. With it, we can convert the CHM file to a more portable format, such as PDF or EPUB. This may be very helpful for devices that don’t support CHM files.

4.1. Installing Calibre

Let’s first install Calibre:

$ sudo apt install calibre

To complete the installation, we run the calibre command:

$ calibre

This launches a graphical installation wizard. In this wizard, we can set the preferred language and location for the Calibre library:

Language preference for Calibre

In the next window, we choose the Generic option under the Manufacturers and Devices section. Depending on the device on which we’re installing Calibre, we may choose other options.

Finally, we click the Finish button to finalize the setup:

Finalizing Calibre installation

Let’s now see Calibre in action.

4.2. Converting CHM Files

To convert a CHM file to PDF or EPUB using Calibre, we simply add the CHM file to the Calibre library. For this, we use the Add books button option:

Adding Books to Calibre

Following on, we right-click and select the Convert books option or click on the Convert books button:

Converting file with Calibre

On the next window, we select the output format, for example PDF:

Selecting Output format

Finally, after clicking the OK button, the conversion process should start. After the conversion job completes, the output file appears at the preset path.

5. Conclusion

In this article, we learned how to view CHM files in Ubuntu 22.04.

Initially, we used xCHM, which is a simple program. After that, we worked with the Kchmviewer program tailored for KDE. Then, we moved on to Okular, which supports a broad range of file formats, including CHM. Finally, we used the Calibre program. Unlike the others, Calibre converts files from one format to another, e.g., CHM to PDF.