Suppose you have a LyX file, my_thesis.lyx, in the current directory. Then, simply execute a command:
$ lyx -e pdf2 my_thesis.lyx
This will generate an output PDF file: my_thesis.pdf. If a PDF file of the same name already exists, it will be overwritten by the newly generated one.