Is there any command-line software to create e-books from the scratch in Ubuntu?

I would like to automate e-book build from remote repositories. A command-line tool would be useful in this case. Is there any software for Ubuntu?


A wide variety of documents can be converted to ebook (epub, mobi, ...) using ebook-convert which is part of the calibre package.

For example, as long as input is a supported format, an epub can be created with the command:

ebook-convert  input output.epub

Or, if you use kindles:

ebook-convert  input output.mobi

Some input formats include: LIT, MOBI, AZW, EPUB, AZW3, FB2, DOCX, HTML, PRC, ODT, RTF, PDB, TXT, PDF.

If the input file is a PDF, then one may want to add an option:

ebook-convert --enable-heuristics  input.pdf output.epub

Calibre may be available from your package manager but it often helps to install the latest version which is available here.

Authoring a book

As an alternative to calibre, OpenOffice/LibreOffice offers an extension, Writer2ePub, to claims to be able to create "well formatted, easy readable ePub" files with a single click.

The Writer2ePub extension can be downloaded from here.


The software pandoc ( http://pandoc.org/ ) might come in handy for your needs. It can be installed in Ubuntu by opening a terminal (Alt-Ctrl-T) and typing sudo apt install pandoc.

Pandoc can convert between a variety of different formats, including txt, html, xhtml, doc, docx, odt, epub, fb2, docbook, OPML, LaTeX, pdf, markdown, asciidoc, MediaWiki, Dokuwiki, org-mode, and a variety of others.

It does not appear to support conversion to/from mobi or aw3, but could certainly build an epub file from a variety of different sources. Then if you like the epub file it produces, you could use @John1024 's answer to convert to mobi or kindle format.

By starting with a source file that supports formatting, such as markdown, html, asciidoc, or the like, you can get a nicely-formatted epub output. The pandoc README file gives a nice overview of the command-line options that are available (including options for table of contents, fonts, link styles, margins, etc).