How to create a word document in docx form with terminal












10















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.
















  • 3





    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
    yesterday






  • 6





    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
    yesterday






  • 4





    @dessert docx is a file format: Office Open XML

    – wjandrea
    yesterday






  • 3





    "Anyone able to explain if it is even possible with the terminal?" FYI: odt, docx, xlsx are containers. You can gunzip them and have the human readable version of it. Well human readable ... it is an xml and a large one.

    – Rinzwind
    10 hours ago






  • 3





    If your objective is learn bash, this isn't a bash operation. Using 3rd party tools in bash isn't using bash. If you want to learn bash, try to combine 2 or more separate tools into something useful. You don't even need bash to do this.

    – Braiam
    6 hours ago
















10















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.
















  • 3





    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
    yesterday






  • 6





    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
    yesterday






  • 4





    @dessert docx is a file format: Office Open XML

    – wjandrea
    yesterday






  • 3





    "Anyone able to explain if it is even possible with the terminal?" FYI: odt, docx, xlsx are containers. You can gunzip them and have the human readable version of it. Well human readable ... it is an xml and a large one.

    – Rinzwind
    10 hours ago






  • 3





    If your objective is learn bash, this isn't a bash operation. Using 3rd party tools in bash isn't using bash. If you want to learn bash, try to combine 2 or more separate tools into something useful. You don't even need bash to do this.

    – Braiam
    6 hours ago














10












10








10


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 yesterday









Silver FlashSilver Flash

604




604




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.








  • 3





    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
    yesterday






  • 6





    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
    yesterday






  • 4





    @dessert docx is a file format: Office Open XML

    – wjandrea
    yesterday






  • 3





    "Anyone able to explain if it is even possible with the terminal?" FYI: odt, docx, xlsx are containers. You can gunzip them and have the human readable version of it. Well human readable ... it is an xml and a large one.

    – Rinzwind
    10 hours ago






  • 3





    If your objective is learn bash, this isn't a bash operation. Using 3rd party tools in bash isn't using bash. If you want to learn bash, try to combine 2 or more separate tools into something useful. You don't even need bash to do this.

    – Braiam
    6 hours ago














  • 3





    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
    yesterday






  • 6





    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
    yesterday






  • 4





    @dessert docx is a file format: Office Open XML

    – wjandrea
    yesterday






  • 3





    "Anyone able to explain if it is even possible with the terminal?" FYI: odt, docx, xlsx are containers. You can gunzip them and have the human readable version of it. Well human readable ... it is an xml and a large one.

    – Rinzwind
    10 hours ago






  • 3





    If your objective is learn bash, this isn't a bash operation. Using 3rd party tools in bash isn't using bash. If you want to learn bash, try to combine 2 or more separate tools into something useful. You don't even need bash to do this.

    – Braiam
    6 hours ago








3




3





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
yesterday





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
yesterday




6




6





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
yesterday





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
yesterday




4




4





@dessert docx is a file format: Office Open XML

– wjandrea
yesterday





@dessert docx is a file format: Office Open XML

– wjandrea
yesterday




3




3





"Anyone able to explain if it is even possible with the terminal?" FYI: odt, docx, xlsx are containers. You can gunzip them and have the human readable version of it. Well human readable ... it is an xml and a large one.

– Rinzwind
10 hours ago





"Anyone able to explain if it is even possible with the terminal?" FYI: odt, docx, xlsx are containers. You can gunzip them and have the human readable version of it. Well human readable ... it is an xml and a large one.

– Rinzwind
10 hours ago




3




3





If your objective is learn bash, this isn't a bash operation. Using 3rd party tools in bash isn't using bash. If you want to learn bash, try to combine 2 or more separate tools into something useful. You don't even need bash to do this.

– Braiam
6 hours ago





If your objective is learn bash, this isn't a bash operation. Using 3rd party tools in bash isn't using bash. If you want to learn bash, try to combine 2 or more separate tools into something useful. You don't even need bash to do this.

– Braiam
6 hours ago










2 Answers
2






active

oldest

votes


















24














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





















  • 6





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

    – dessert
    yesterday








  • 1





    Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

    – rcjohnson
    5 hours ago



















13














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.



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









    24














    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





















    • 6





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

      – dessert
      yesterday








    • 1





      Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

      – rcjohnson
      5 hours ago
















    24














    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





















    • 6





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

      – dessert
      yesterday








    • 1





      Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

      – rcjohnson
      5 hours ago














    24












    24








    24







    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 yesterday

























    answered yesterday









    wjandreawjandrea

    9,06542262




    9,06542262








    • 6





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

      – dessert
      yesterday








    • 1





      Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

      – rcjohnson
      5 hours ago














    • 6





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

      – dessert
      yesterday








    • 1





      Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

      – rcjohnson
      5 hours ago








    6




    6





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

    – dessert
    yesterday







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

    – dessert
    yesterday






    1




    1





    Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

    – rcjohnson
    5 hours ago





    Oh wow! First time one of my answers has been referenced somewhere else :) Came here to say Pandoc

    – rcjohnson
    5 hours ago













    13














    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.



    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






























      13














      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.



      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




























        13












        13








        13







        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.



        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 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.



        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 15 hours ago

























        answered yesterday









        dessertdessert

        22.9k563101




        22.9k563101






















            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