Sharing documents between several operating systems and programs is a typical issue in an office or production setting.
You may use LibreOffice Writer or AbiWord on Linux to generate, open, and edit Microsoft Word documents.
Both are capable word processors that can read and produce documents in the Word .doc and .docx formats.
Antiword (.doc files) and docx2txt (.docx) are helpful applications you may use if you want command-line utilities that extract text from Word files.
We’ll look at these four applications and how to utilize them in this article.
On some of the most widely used Linux distributions, including Debian, Ubuntu, Fedora, OpenSUSE, CentOS, and Arch Linux, we’ll walk through their installation.
On your Linux machine, we will also assist you in installing certain fundamental Microsoft TrueType fonts.
LibreOffice
Microsoft Office programs, such as Microsoft Word, are compatible with LibreOffice, a free, open-source productivity office suite that is actively maintained and constantly updated.
Your LibreOffice Writer documents may be saved in either the .doc or .docx format, and one of these will then open successfully in Microsoft Word.
Setting up LibreOffice
You may install LibreOffice by using your package manager.
Open a terminal and enter the command that is appropriate for your operating system to install it:
Debian 8, Ubuntu 15
sudo apt-get update && sudo apt-get install LibreOffice
Fedora 23
sudo dnf update && sudo dnf install LibreOffice
OpenSUSE 10
sudo zypper refresh && sudo zypper install LibreOffice
Arch Linux 2016
sudo pacman -Sy libreoffice-fresh
CentOS 7
sudo yum update && sudo yum install libreoffice
Following installation, LibreOffice ought to show up in your GUI’s Applications menu.
Run it via the terminal as well by using the following command:
libreoffice
AbiWord
Another free and open-source word processor is AbiWord.
It offers an easy-to-use interface that has been developed for approximately 20 years.
It can open, edit, and save Microsoft Word .doc and .docx files just like LibreOffice.
Abiword doesn’t include a full office suite as LibreOffice does, thus it takes up less space and uses fewer system resources.
Setting up AbiWord
Debian 8, Ubuntu 15
sudo apt-get upgrade && sudo apt-get install abiword
Fedora 23
sudo dnf update && sudo dnf install abiword
OpenSUSE 10
sudo zypper refresh && sudo zypper install abiword
Arch Linux 2016
pacman -Sy abiword
CentOS 7
sudo yum update && sudo yum install abiword
Antiword
A command-line utility called Antiword turns a.doc file’s contents into plain text.
Using Antiword
The plain text of the file is written to standard output when antiword is run against a Word .doc file.
When it comes to formatting tables, Antiword excels.
It may also output to PDF and contain photos as PostScript objects.
The output may be directed to a text file:
antiword file.doc > file.txt
Alternatively, you may copy the content to vim and open it straight in a text editor:
antiword file.doc | vim –
Pico:
antiword file.doc | pico –
Setting up Antiword
Debian 8, Ubuntu 15
sudo apt-get update && sudo apt-get install antiword
Fedora 23
sudo dnf update && sudo dnf install antiword
OpenSUSE 10
sudo zypper refresh && sudo zypper install antiword
Docx2txt
sudo pacman -Sy antiword
CentOS 7
sudo yum update && sudo yum install antiword
Docx2txt
A command-line program called Docx2txt turns .docx files into plain text. .doc files are not converted.
Call docx2txt and enter a hyphen as the output file name to print the contents of a .docx file to the terminal screen or to a file.
Use the following command pattern to transform a. docx file and output it as a text file:
docx2txt file.docx file.txt
Or:
docx2txt file.docx – > file.txt
Use the following command pattern in vim to open a .docx text file:
docx2txt file.docx – | vim –
Open it in nano to:
docx2txt file.docx – | nano –
Follow the directions below for your particular Linux version to install doc2txt:
Debian 8
sudo apt-get update && sudo apt-get install docx2txt
Ubuntu 15
sudo apt-get update && sudo apt-get install docx2txt
Arch Linux 2016
sudo pacman -Sy docx2txt
Fedora 23
There is no package for docx2txt in the Fedora repository, but you may manually install it:
Visit the docx2txt page on SourceForge to download the source.
Take the archive out:
tar xzvf docx2txt-1.4.tgz
Installing or upgrading these packages is necessary to ensure that your system has Perl, Unzip, and Make installed:
sudo dnf update && sudo dnf install perl unzip make
Run make as root after that to install:
sudo make
As of right now, docx2txt is set up as docx2txt.sh.
You might use the following command to turn the word-document .docx file into a text file:
docx2txt.sh word-document.docx
Automatically, the converted text file is stored as word-document.txt.
OpenSUSE
The docx2txt package is not available in the SUSE repository, but you may obtain it from the docx2txt website on SourceForge.
Take the archive out:
tar xzvf docx2txt-1.4.tgz
Installing or upgrading these packages is necessary to ensure that your system has Perl, Unzip, and Make installed:
sudo zypper update && sudo zypper install perl unzip make
Run make as root after that to install:
sudo make
As of right now, docx2txt is set up as docx2txt.sh.
You might use the following command to turn the word-document .docx file into a text file:
docx2txt.sh word-document.docx
Automatically, the converted text file is stored as word-document.txt.
CentOS 7
The docx2txt package is not available in the CentOS repository, but you may obtain it from SourceForge. Take the archive out:
tar xzvf docx2txt-1.4.tgz
Installing or upgrading these packages is necessary to ensure that your system has Perl, Unzip, and Make installed:
sudo yum update && sudo yum install perl unzip make
Run make as root after that to install:
sudo make
As of right now, docx2txt is set up as docx2txt.sh.
You might use the following command to turn the word-document.docx file into a text file:
docx2txt.sh word-document.docx
Automatically, the converted text file is stored as word-document.txt.
Installing Fonts Compatible with Microsoft
Microsoft fonts are accessible on Linux.
If you plan to work with Microsoft Word files, especially those that were produced on a Windows PC, install them.
Basic fonts consist of:
- Andale Mono
- Arial Black
- Arial
- Calabri
- Comic
- Cambria
- Courier
- Impact
- Trebuchet
- Times
- Verdana
- Webdings
Take the following actions to install them:
Fedora 32
Get the SourceForge RPM package for installing msttcore.
Install the necessary software packages:
sudo dnf update && sudo dnf install curl cabextract xorg-x11-font-utils fontconfig
Install the RPM package next:
sudo dnf install msttcore-fonts-installer-2.6-1.noarch.rpm
OpenSUSE 10
Download the SourceForge RPM package for the msttcore installation.
Install the necessary software packages:
sudo zypper update && sudo zypper install curl cabextract xorg-x11-font-utils fontconfig
Install the RPM package next:
sudo zypper install msttcore-fonts-installer-2.6-1.noarch.rpm
CentOS 7
Download the SourceForge RPM package for the msttcore installation.
Install the necessary software packages:
sudo yum update && sudo yum install curl cabextract xorg-x11-font-utils fontconfig
Install the regional RPM package next:
sudo yum install msttcore-fonts-installer-2.6-1.noarch.rpm
Arch Linux 2016
Download the SourceForge RPM package for the msttcore installation.
Install the necessary software packages:
pacman -Sy rpmextract x11-font-utils fontconfig
Extract the local RPM package’s contents:
rpmextract.sh msttcore-fonts-installer-2.6-1.noarch.rpm
This command creates two folders, etc and usr, which match to your /etc and /usr directories, and extracts the raw contents of the RPM file.
usr/share/fonts/msttcore is where you can get the font files themselves.