Solution 1:

Once you have installed the calibre package, you can use the GUI, but if you want to script it, there is also a command line converter installed as part of the calibre package - ebook-convert (docs). The simplest way to call it would be:

ebook-convert document.pdf .mobi

which will convert the pdf into MOBI format with the same name. That should "just work" but if you want to go deeper then see the detailed documentation on conversion.

Note that Calibre supports lots of formats, not just MOBI, for both input and output.

Solution 2:

Try http://calibre-ebook.com/ I'm not sure how well it works for Linux but on Windows it is the perfect solution for managing your eBook library and obviously also converting from anything

Solution 3:

You can also do it online... Although it is not always recommendable to convert PDFs to Mobi since the formats are quite different.

http://www.mobi-to-pdf.com/