Calibre, the ebook library offers the ability to convert ebooks from and to multiple formats. It also has a CLI utility. There are a number of options for the conversion. The following command illustrates a simple conversion from one format to another.

    ./ebook-convert.exe "book.epub" "book.mobi" --pretty-print --enable-heuristics