As ebook readers have become more and more popular over the past few years, there have cropped up numerous websites that make purchasing and downloading ebooks incredibly simple.  The already existing Project Gutenberg website, for instance, which already made tens of thousands of books available as txt and html files, now makes those same books available in formats ready for reading on the Kindle, Nook, and other popular ebook devices.  In addition, some websites that sell ebooks also make available – for free – public domain books.  Among those websites are Feedbooks, the Amazon Kindle Store, and more.

Of course, sometimes – especially with free books – you may find errors.  Sometimes the formatting of a book has gotten off kilter, while other times there are spelling errors.  We’ve previously shown how to install and create ePub files with a program called Sigil that makes it simple to edit your ePub files, but it’s also possible to perform very basic edits using nothing more than an archiving program and a text editor.  Here’s how.

First, let’s grab a free ePub from Feedbooks, so we’ll have something to edit.  We’ll grab the copy of “War Of The Worlds,” by H.G. Wells, located at this link.

01War_Of_The_Worlds

Simply click the EPUB link to the right, and download your book.  We downloaded our copy to the Desktop.  Once downloaded, we need to make a simple change.  Rename the ePub file so that its extension is no longer .epub, but uses the .zip extension.

02Change_epub_Extension

Now that we have the extension changed, simply unzip the archive.

03Expand_Archive

You should now have a folder with the same name as your ePub file.  It will be called “H. G. Wells – The War of the Worlds” if you grabbed the same ebook we did.

04Unzipped_Archive

Inside this archive you’ll find three items.  There is a document called “mimetype” and two folders, named META-INF and OPS.

05Files_Inside_Archive

The html or xhtml files that make up the ePub are located in the OPS folder, along with other folders, such as css and images.  Since most ePub files you’ll find will split up each chapter into its own html or xhtml file, you’ll likely be able to tell which file makes up a specific chapter, but you may need a bit of guesswork to get it right.  Once you’ve found the correct document, you can open it in your favorite text or html editor.  In our example we’re using a Linux text editor called Medit, but you can use whichever you prefer.

06Open_File_In_Text_Editor

Once opened, simply make the changes you want.

07Edit_In_Text_Editor

When done, simply save your changes to the document.  When you’ve made all the changes you want, it’s time to recreate the zip archive (which we’ll later modify by changing the extension back to .epub from .zip).

So, go ahead and open your archive manager.  In Linux, you can use File Roller (the default for GNOME), Ark (the default for KDE), and Xarchiver (the default for Xfce).  In the screenshot below, you’ll see Xarchiver.

08Archive_Manager

Now, use the toolbar or menu to create a new archive.

09Create_New_Archive

You’ll also need to give it a name.

10Name_New_Archive

We now need to add our files back into the new archive.

IMPORTANT: We need to ensure two things when adding files into our new zip archive.  First, the mimetype document needs to be added first (to ensure all ebook readers notice it before trying to parse through the other files inside), and second, the mimetype document needs to be added uncompressed (you may see it called “stor” mode).

11Files_Inside_Zip_Archive

When finished, simply close your archive manager (being sure to save the archive if your program doesn’t automatically save changes).  You should now have a new zip archive on your desktop, which we’ll now rename with the .epub extension.

12Rename_Zip_To_Epub

Note: be sure that your “old” and “new” zip archives and epub files don’t have identical names, or you’ll run into naming conflicts.

You can now test the newly edited epub in your favorite software.

13Read_Epub

And that’s it!  This method of editing an epub works just fine for small jobs.  However, should you need to perform massive changes, such as changing file names (inside the epub), adding or removing photos or changing meta-data, then Sigil is probably a better choice.  For simple jobs, however, this is quick and easy, and doesn’t require installing any additional software.