Command to locate the word within a text file


Transfered from Linux Config Disqus comments:

Give the exact command that can locate the word “to” (without quotes) in a file named “file1” (without quotes), but does not display words like “total” or “stone” that are in the same file.
-w option of a grep command allows user to search a content of a file for a words, where word is separated on both sides by a white space.

grep -w to file1