How to create a word document in docx form with terminal
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
New contributor
add a comment |
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
New contributor
1
File extensions don’t really matter in Ubuntu, so if youtouch 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
add a comment |
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
New contributor
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
bash
New contributor
New contributor
New contributor
asked 2 hours ago
Silver FlashSilver Flash
61
61
New contributor
New contributor
1
File extensions don’t really matter in Ubuntu, so if youtouch 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
add a comment |
1
File extensions don’t really matter in Ubuntu, so if youtouch 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
add a comment |
2 Answers
2
active
oldest
votes
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
1
+1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.
– dessert
1 hour ago
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
1
+1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.
– dessert
1 hour ago
add a comment |
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
1
+1 TIL about Pandoc, which in fact can convert a ton of markup formats into each other.
– dessert
1 hour ago
add a comment |
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
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
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
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
edited 1 hour ago
answered 2 hours ago
dessertdessert
22.8k56399
22.8k56399
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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