I am not a expert user of any of the two commands but as per my understanding,
if I want to search "Theory of Computation" book on my computer,
locate -i computation | grep -i theory
should give me all and only files with both theroy
and computation
in their names.
locate -i computation
should output all files with computation
in their names and from that list, thanks to the pipe, grep -i theory
should output all the files having theory
in their names, thus giving me my desired output.
However, when I run the above command, I get outputs like
/root/books/History theory and practice of the electric telegraph.pdf
which means that my understanding of at least one of these commands (or pipe) is wrong. Where am I mistaken?