Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: March 18, 2024
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.
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.
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.
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:
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 can handle CHM files, but it doesn’t support JavaScript in ebooks. Specifically, Javascript lets us add pages with interactive content.
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 offers many features:
Also, Kchmviewer can correctly identify and display file encoding in CHM files.
Okular is a universal document viewer with many features:
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 is more feature-rich and versatile compared to xCHM and Kchmviewer.
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.
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:
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:
Let’s now see Calibre in action.
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:
Following on, we right-click and select the Convert books option or click on the Convert books button:
On the next window, we select the output format, for example PDF:
Finally, after clicking the OK button, the conversion process should start. After the conversion job completes, the output file appears at the preset path.
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.