Let's say I have 2000 .ODT files. Their names are random numbers. How do I go about searching for, let's say, "pricing list"? How do I find the document I need without opening all of them one by one and checking to see if it's the right one?

Is there some program to search through the words in the documents without opening them?

5 Answers 5


This works for anything that openoffice can read; I wanted odt only in this case:

find -name \*.odt -exec sh -c 'unoconv --stdout -f text "{}" | grep -i string_to_search_for' \;
  • 1
    If you add -print, then also the filenames of matching files are shown.
    – tillmo
    Feb 21, 2023 at 10:31

An alternative is Recoll Install Recoll. Once it has indexed your files, it finds the matching files quite fastly. Also searches inside ODSs, ODPs and PDFs. Works pretty well.

  • The link in the Software Center image has a typo (“recall” at the end). Aug 1, 2017 at 17:34
  • @Guildenstern Thanks, I fixed it. You can edit questions/answers for improving them too, if you want to. =)
    – yuric
    Aug 2, 2017 at 18:13

You would need a full text indexing solution, which has a filter to support indexing the full text of those files.

One option for this is the tracker package in Ubuntu. You'll need to install tracker and tracker-miner-fs for this, and you'll also likely want tracker-gui for the search tool UI.


You can use the --cat option to libreoffice to get the text from all the files without opening them (it can take some time, depending on file size). This leads to the solution

libreoffice --cat *.odt | grep -i string_to_search_for

Install antiword and odt2txt with apt install.

This code will search through all .doc and .odt files in a directory for a given string that may include spaces:

dgrep (make sure to make executable and put in your path!)


#USE: dgrep   this text

#grep for doc files, using antiword
#grep for odt files, using odt2txt

#Run in a given directory with doc / odt files


for i in *.doc*
    antiword $i | grep "$string" > found
    if [ -s found ] 
     echo "(("$i"))"
     more found

for j in *.odt
    odt2txt $j | grep "$string" > found2
    if [ -s found2 ] 
     echo "(("$j"))"
     more found2

/bin/rm found found2 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .