In an office or production environment, sharing documents between different applications and operating systems is a common issue. If you need to create, open, and edit Microsoft Word documents in Linux, you can use LibreOffice Writer or AbiWord. Both are robust word processing applications that read and write files in Word .doc and .docx formats.
If you need command-line tools that extract the text from Word files, Antiword (.doc files) and docx2txt (.docx) are useful programs to have at your disposal.
In this tutorial, we'll look at these four applications and how you can use them. We'll walk through installing them on several of the most popular Linux distributions, including Debian, Ubuntu, Fedora, OpenSUSE, CentOS, and Arch Linux. We'll also help with installing the core Microsoft TrueType fonts on your Linux system.
- Antiword (.doc -> text)
- Docx2txt (.docx -> text)
There are a number of Linux packages, containing Microsoft TrueType fonts, that you can download and install onto your Linux machine. The exact steps may be different on various Linux distributions. On Ubuntu, use Synaptic Package Manager to find and install the ttf-mscorefonts-installer package. On openSUSE, use Yast2 → Software Management. Since we have here SuSE Linux and not MS Win, we need a way to extract the fonts, which is done by cabextract. However cabextraxt does not care about any EULAs. If you, however install the Fonts the 'legal' way through YAST On-line update, then you'll be asked to accept the MS EULA and you are legally clean.
LibreOffice
LibreOffice is a free, open-source, actively maintained and frequently updated office productivity suite that is compatible with Microsoft Office applications, including Microsoft Word. You can save your LibreOffice Writer documents in .doc or .docx format, and then either opens correctly in Microsoft Word.
Installing LibreOffice
LibreOffice can be installed using your package manager. To install it, open a terminal and use the following command appropriate for your operating system:
Debian 8, Ubuntu 15
Fedora 23
OpenSUSE 10
CentOS 7
Arch Linux 2016
Once LibreOffice is installed, it should appear in the Applications menu of your GUI. You can also run it from a terminal with the command:
AbiWord
AbiWord is another free and open-source word processor. It has a clean, simple interface developed for almost twenty years. Like LibreOffice, it can open, edit, and save Microsoft Word .doc and .docx files. Unlike LibreOffice, Abiword is not a complete office suite, so it has a smaller footprint and consumes fewer system resources.
Installing AbiWord
Debian 8, Ubuntu 15
Fedora 23
OpenSUSE 10
CentOS 7
Arch Linux 2016
Antiword
Antiword is a command-line tool that converts the contents of a .doc file to plain text.
NoteAntiword only converts .doc files. If you need to convert a .docx file, see docx2txt in the next section.
Using Antiword
Running antiword with the name of a Word .doc file outputs the plain text of the file to standard output.
Antiword does a great job of formatting tables. It also has options for including images as PostScript objects and outputting to PDF.
You can redirect the output to a text file:
Or, if you want to open it directly in a text editor, you can pipe the text to vim:
Or pico:
Installing antiword
Debian 8, Ubuntu 15
Fedora 23
OpenSUSE 10
CentOS 7
Docx2txt
Docx2txt is a command-line tool that converts .docx files to plain text. (It does not convert .doc files.)
To print the contents of a .docx file to the terminal screen or a file, call docx2txt and specify a dash as the output file name. In this example, notice the dash at the end of the command.
To convert a .docx file and output to a text file, use the command form:
Or:
To open the .docx text in vim, use the command form:
To open it in nano:
To install doc2txt, follow the instructions for your version of Linux below:
Debian 8
Ubuntu 15
Fedora 23
Fedora's repositories do not offer a package for docx2txt, but you can install it manually:
Download the source from SourceForge's docx2txt page. Extract the archive:
You need to make sure that perl, unzip and make are installed on your system, so install or upgrade those packages now:
Then, run make as the root user to install:
Docx2txt is now installed as docx2txt.sh. For instance, to convert the file word-document.docx to a text file, you can run:
The converted text file automatically saves as word-document.txt.
OpenSUSE 10
SUSE repositories do not offer a package for docx2txt, but you can download it from SourceForge's docx2txt page. Extract the archive:
You need to make sure that perl, unzip and make are installed on your system, so install or upgrade those packages now:
Then, run make as root to install:
Docx2txt is now installed as docx2txt.sh. For instance, to convert the file word-document.docx to a text file, you can run:
The converted text file is automatically saved as word-document.txt.
CentOS 7
CentOS repositories do not offer a package for docx2txt, but you can download it from SourceForge's docx2txt page. Extract the archive:
Arial Font In Opensuse Linux Version
You need to make sure that perl, unzip and make are installed on your system, so install or upgrade those packages now:
Then, run make as root to install:
Docx2txt is now installed as docx2txt.sh. For instance, to convert the file word-document.docx to a text file, you can run:
The converted text file is automatically saved as word-document.txt.
Arch Linux 2016
Installing Microsoft-compatible fonts
The core Microsoft fonts are available on Linux. Install them if you are going to be working with Microsoft Word files — especially if they were created on a Windows system. The core fonts include:
- Andale Mono
- Arial
- Arial Black
- Calabri
- Cambria
- Comic
- Courier
- Impact
- Times
- Trebuchet
- Verdana
- Webdings
To install them, follow these steps:
Arial Font In Opensuse Linux Pdf
Debian 8, Ubuntu 15
Fedora 23
Download the msttcore installer RPM package from SourceForge.
Install packages required for installation:
Then install the local RPM package:
OpenSUSE 10
Download the msttcore installer RPM package from SourceForge.
Install packages required for installation:
Then install the local RPM package:
CentOS 7
Download the msttcore installer RPM package from SourceForge.
Install packages required for installation:
Then install the local RPM package:
Arch Linux 2016
Download the msttcore installer RPM package from SourceForge.
Install packages required for installation:
Extract the contents of the local RPM package:
This command extracts the raw contents of the RPM file and creates two directories, etc and usr that correspond to your /etc and /usr directories. The font files themselves are located in usr/share/fonts/msttcore.
Additional information
How To Install TTF Fonts in Linux
I really like the Hack font – it’s used in my terminal apps on MacOS, Linux and even Windows workstations. This short post demonstrates how to install Hack font, but you can use the steps to configure any other TrueType Font (TTF) on your system.
Step 1: Download the TTF font files
In my case, I downloaded the Hack v3 ZIP archive.
Naturally, you need to unpack it:
Step 2: Copy TTF files into local fonts directory
First you’re going to have to create it in your own homedir:
Now let’s copy the font files into that local fonts directory:
Step 3: Refresh fonts cache with fc-cache command
Just run the fc-cache command like this:
This command will show a list of fonts locations that it inspects and caches for system use. Among the lines of output you can see my home directory:
Step 4: Review available fonts
This should now report that your graphics system (X11/Xorg) has access, the list will include the newly installed fonts Hack:
That’s it! Since I wanted this Hack font specifically for terminal use, I went and updated my default profile in GNOME Terminal app:
to enjoy the font: