Linux. Convert doc or docx to pdf from command line

To batch convert a set of .doc or .docx files to .pdf in terminal, not using a GUI, lowriter can be used as a command line tool (lowriter is a part of LibreOffice)

lowriter --convert-to pdf *.doc