Say you just bought an Amazon Kindle or a Barnes and Noble Nook. You want to convert your eBook collection to .EPUB or .MOBI format. For this, install Calibre. The application not only provides you with a graphical way to manage your eBook collection, but also comes with a set of useful command-line tools. One of these is ebook-convert.
This tool can help you convert between tens of standard formats like EPUB, FB2, LIT, LRF, MOBI, OEB, PDB, PDF, PML, RB, RTF, TCR, TXT, HTML and more. Even CBR and CBZ (comic book formats) are supported.
The syntax is simple:
ebook-convert input_format output_format
For example, if you want to convert a comic book archive to something readable on an e-ink screen, use
ebook-convert filename.cbz filename.epub
ebook-convert filename.cbz filename.pdf
Not only will ebook-convert convert the file, but it will also trim the white spaces around the page so they will better fit the small screen of an electronic eBook reader.