HostOnNet Blog

How to convert a text file into a Word document on Ubuntu

Looking for Linux Server Admin or WordPress Expert? We can help.

This tutorial explains how to convert a Text file into a Word document in ubuntu.  For this purpose, you can use a command-line utility called pandoc, which converts from one markup format to another from the command line.

First we need to install Pandoc on Ubuntu. We can do the same by running below command On Ubuntu, Debian or Linux Mint:

 sudo apt-get install pandoc 

Installation result will be as follows:

pandoc_install

If you are using Fedora, run below command:

sudo yum install pandoc

On CentOS, first enable EPEL repo, and then use yum command like above.

Below is my text file, which I am going to convert into word document.

my_text_file

Once a text file is ready, run the following command:

pandoc -o text_file.docx text_file.txt

text_file_to_doc_file

This is the output of the generated Word document:

my_document_file

About Vineesh Mohan

A Technical Support specialist with strong customer service and good communication skills. I live in the city of Cochin, which known as the Queen of Arabian Sea.
Posted in CentOS, Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.