How to create a word document in docx form with terminal












1















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.










share|improve this question







New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    File extensions don’t really matter in Ubuntu, so if you touch file.docx you have a docx file. :) What makes a docx file a docx file for you?

    – dessert
    2 hours ago






  • 2





    touch command lets you specify the extension; touch foo.docx, but that will create an empty file. Is that what you want? Otherwise, loffice --convert-to docx foo.odt will work in a terminal.

    – waltinator
    2 hours ago






  • 1





    @dessert docx is a file format: Office Open XML

    – wjandrea
    1 hour ago











  • In Linux, file extensions don't matter. See askubuntu.com/a/803440/231142 It is the contents that matter. Once the file is converted to have a docx (OOXML) inside of it, there are no CLI editors that can edit it anymore. It would now be dependent of the application designed to edit the file. touch creates a blank file ready for any format to be added into it.

    – Terrance
    1 hour ago


















1















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.










share|improve this question







New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    File extensions don’t really matter in Ubuntu, so if you touch file.docx you have a docx file. :) What makes a docx file a docx file for you?

    – dessert
    2 hours ago






  • 2





    touch command lets you specify the extension; touch foo.docx, but that will create an empty file. Is that what you want? Otherwise, loffice --convert-to docx foo.odt will work in a terminal.

    – waltinator
    2 hours ago






  • 1





    @dessert docx is a file format: Office Open XML

    – wjandrea
    1 hour ago











  • In Linux, file extensions don't matter. See askubuntu.com/a/803440/231142 It is the contents that matter. Once the file is converted to have a docx (OOXML) inside of it, there are no CLI editors that can edit it anymore. It would now be dependent of the application designed to edit the file. touch creates a blank file ready for any format to be added into it.

    – Terrance
    1 hour ago
















1












1








1








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.










share|improve this question







New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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.







bash






share|improve this question







New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Silver FlashSilver Flash

61




61




New contributor




Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Silver Flash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1





    File extensions don’t really matter in Ubuntu, so if you touch file.docx you have a docx file. :) What makes a docx file a docx file for you?

    – dessert
    2 hours ago






  • 2





    touch command lets you specify the extension; touch foo.docx, but that will create an empty file. Is that what you want? Otherwise, loffice --convert-to docx foo.odt will work in a terminal.

    – waltinator
    2 hours ago






  • 1





    @dessert docx is a file format: Office Open XML

    – wjandrea
    1 hour ago











  • In Linux, file extensions don't matter. See askubuntu.com/a/803440/231142 It is the contents that matter. Once the file is converted to have a docx (OOXML) inside of it, there are no CLI editors that can edit it anymore. It would now be dependent of the application designed to edit the file. touch creates a blank file ready for any format to be added into it.

    – Terrance
    1 hour ago
















  • 1





    File extensions don’t really matter in Ubuntu, so if you touch file.docx you have a docx file. :) What makes a docx file a docx file for you?

    – dessert
    2 hours ago






  • 2





    touch command lets you specify the extension; touch foo.docx, but that will create an empty file. Is that what you want? Otherwise, loffice --convert-to docx foo.odt will work in a terminal.

    – waltinator
    2 hours ago






  • 1





    @dessert docx is a file format: Office Open XML

    – wjandrea
    1 hour ago











  • In Linux, file extensions don't matter. See askubuntu.com/a/803440/231142 It is the contents that matter. Once the file is converted to have a docx (OOXML) inside of it, there are no CLI editors that can edit it anymore. It would now be dependent of the application designed to edit the file. touch creates a blank file ready for any format to be added into it.

    – Terrance
    1 hour ago










1




1





File extensions don’t really matter in Ubuntu, so if you touch file.docx you have a docx file. :) What makes a docx file a docx file for you?

– dessert
2 hours ago





File extensions don’t really matter in Ubuntu, so if you touch file.docx you have a docx file. :) What makes a docx file a docx file for you?

– dessert
2 hours ago




2




2





touch command lets you specify the extension; touch foo.docx, but that will create an empty file. Is that what you want? Otherwise, loffice --convert-to docx foo.odt will work in a terminal.

– waltinator
2 hours ago





touch command lets you specify the extension; touch foo.docx, but that will create an empty file. Is that what you want? Otherwise, loffice --convert-to docx foo.odt will work in a terminal.

– waltinator
2 hours ago




1




1





@dessert docx is a file format: Office Open XML

– wjandrea
1 hour ago





@dessert docx is a file format: Office Open XML

– wjandrea
1 hour ago













In Linux, file extensions don't matter. See askubuntu.com/a/803440/231142 It is the contents that matter. Once the file is converted to have a docx (OOXML) inside of it, there are no CLI editors that can edit it anymore. It would now be dependent of the application designed to edit the file. touch creates a blank file ready for any format to be added into it.

– Terrance
1 hour ago







In Linux, file extensions don't matter. See askubuntu.com/a/803440/231142 It is the contents that matter. Once the file is converted to have a docx (OOXML) inside of it, there are no CLI editors that can edit it anymore. It would now be dependent of the application designed to edit the file. touch creates a blank file ready for any format to be added into it.

– Terrance
1 hour ago












2 Answers
2






active

oldest

votes


















2














According to this thread over at Unix & Linux, you can use Pandoc.



From skimming the documentation, I think you could use it like:



echo "Hello" | pandoc -o out.docx


Then out.docx will be a docx file with "Hello" in it.





As well, I found this Python module: python-docx






share|improve this answer





















  • 1





    +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

    – dessert
    1 hour ago





















2














LibreOffice comes with a command-line tool called libreoffice, this command 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.



Usage example



$ 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





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Silver Flash is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116529%2fhow-to-create-a-word-document-in-docx-form-with-terminal%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    According to this thread over at Unix & Linux, you can use Pandoc.



    From skimming the documentation, I think you could use it like:



    echo "Hello" | pandoc -o out.docx


    Then out.docx will be a docx file with "Hello" in it.





    As well, I found this Python module: python-docx






    share|improve this answer





















    • 1





      +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

      – dessert
      1 hour ago


















    2














    According to this thread over at Unix & Linux, you can use Pandoc.



    From skimming the documentation, I think you could use it like:



    echo "Hello" | pandoc -o out.docx


    Then out.docx will be a docx file with "Hello" in it.





    As well, I found this Python module: python-docx






    share|improve this answer





















    • 1





      +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

      – dessert
      1 hour ago
















    2












    2








    2







    According to this thread over at Unix & Linux, you can use Pandoc.



    From skimming the documentation, I think you could use it like:



    echo "Hello" | pandoc -o out.docx


    Then out.docx will be a docx file with "Hello" in it.





    As well, I found this Python module: python-docx






    share|improve this answer















    According to this thread over at Unix & Linux, you can use Pandoc.



    From skimming the documentation, I think you could use it like:



    echo "Hello" | pandoc -o out.docx


    Then out.docx will be a docx file with "Hello" in it.





    As well, I found this Python module: python-docx







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 1 hour ago

























    answered 2 hours ago









    wjandreawjandrea

    8,85042260




    8,85042260








    • 1





      +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

      – dessert
      1 hour ago
















    • 1





      +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

      – dessert
      1 hour ago










    1




    1





    +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

    – dessert
    1 hour ago







    +1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.

    – dessert
    1 hour ago















    2














    LibreOffice comes with a command-line tool called libreoffice, this command 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.



    Usage example



    $ 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





    share|improve this answer






























      2














      LibreOffice comes with a command-line tool called libreoffice, this command 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.



      Usage example



      $ 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





      share|improve this answer




























        2












        2








        2







        LibreOffice comes with a command-line tool called libreoffice, this command 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.



        Usage example



        $ 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





        share|improve this answer















        LibreOffice comes with a command-line tool called libreoffice, this command 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.



        Usage example



        $ 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






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago

























        answered 2 hours ago









        dessertdessert

        22.8k56399




        22.8k56399






















            Silver Flash is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Silver Flash is a new contributor. Be nice, and check out our Code of Conduct.













            Silver Flash is a new contributor. Be nice, and check out our Code of Conduct.












            Silver Flash is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116529%2fhow-to-create-a-word-document-in-docx-form-with-terminal%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to label and detect the document text images

            Vallis Paradisi

            Tabula Rosettana