You Are Here: Home » Hacks » How-To » Linux » Microsoft » Pragmatism

HOW-TO hack a 'chm' file?

By Debjit on July 12th, 2009 

CHM is a Microsoft Corp baby. This file format according to me is one of the best things to have happened to computing world. CHM file format facilitates archiving of millions of html files into onesingle file, including the images and all. Now, Linux boxes and mac boxes don`t have built-in support for handling CHM files. The most probable reason if it`s exclusion by default from Linux boxes may seem very obvious to you. (read: I <3 MICROSOFT but SOME PEOPLE HAY8 IT). So, no worries, ample tools are available for using CHM files on LINUX and MAC.

Linux users have at their disposal xchm, gnochm and kchmviewer for reading CHM files. All these are available in the default software repositories of the various popular Linux Distros. Fedora 9 users may find an application called Okular already installed. This will take care of the CHM files on Fedora 9 boxes. Other tux users can simply install any of the above mentioned three softwares via their respective repo-tools (YUM for Fedora/RED-HAT/SuSE/Mandriva tch tch and apt-get for debiansa nd ubuntus). Now lets see how we can actually extract the html files from the CHM files. (YES, this can be done). Just follow the following instructions:

1) Install a package called libchm:

for debian/ubuntu:
$ sudo apt-get install libchm-bin

for fedora/redhat/suse:
$ sudo yum -y install chmlib

2) use this command to extract the contents of a file called test.chm to the directory
chmtest/ (works on all distros)

==> $ extract_chmLib test.chm chmtest/

Windows users may also try this extraction of HTML files from CHM files with the use of an
inbuilt utility called hh.exe. In the command line type:

hh.exe -decompile chmtest test.chm

to extract the contents of a file called test.chm to the directory chmtest.

MAC Users may try the hack by following these instructions:

Install the chmdump using port on ur box:
$ sudo port install chmdump

Then extract a CHM file with:
$ chmdump test.chm chmtest.


HOW-TO hack a 'chm' file? was originally published on on July 6, 2009 - 12:26 am (Indian Standard Time)