If the text is stored as plain text inside the document file (whether or not the file itself is composed entirely of plain text), then you can search for it from the command-line with a recursive grep
. This doesn't require indexing first, but searching through all your files takes a very long time so if you ever have to do this more than a couple of times for your whole disk, you should use an indexing search utility instead (like in this answer).
Open a Terminal window (Ctrl+Alt+T).
Change directory to the top of whatever you want to search. For example, to search everything in your home directory, do cd ~
. To search everything on your machine, do cd /
. To search everything in an external drive called DocDrive do cd /media/DocDrive
. If a directory has spaces in its name, enclose it in quotes (e.g., cd '/media/Documents Drive'
.
Run a recursive grep
as follows:
grep -Rs 'word or phrase you are looking for' .
Alternatively, you can skip step 2 and, instead of cd
ing to the folder you want to look inside, replace the .
in step 3 with the name of the folder you want to look inside.
If you want to search through all files including those you don't ordinarily have access to, you can run grep
as root
with sudo
:
sudo grep -Rs 'word or phrase you are looking for' .