I know I can easily create a docx file with libreOffice, but I just want to learn more about using bash. Anyone able to explain if it is even possible with the terminal? The touch command does a decent job but it does not specify any extension.
LibreOffice comes with a command-line tool called
soffice which has
libreoffice pointing to it, this tool has a
--convert-to option which lets you easily convert files in the same way the GUI program does, e.g.:
libreoffice --convert-to docx file.txt
This creates the file
file.docx in Office Open XML Text format in the current directory.
$ echo some text > file.txt $ libreoffice --convert-to docx file.txt convert /home/dessert/file.txt -> /home/dessert/file.docx using filter : Office Open XML Text $ file file.docx file.docx: Microsoft OOXML