The look command is used to query English words. You only need to give it the first character string to be queried. It will display all the words whose start character string meets this condition.
Syntax
Look [-adf] [-t <character string>] [character string] [Dictionary File]
Parameter description:
- -A uses another dictionary file web2, which is also located in the/usr/dict directory.
- -D: only English letters and numbers are compared.
- -F ignores the case sensitivity of characters.
- -T <suffix string>: specifies the suffix string.
Instance
To search for all lines starting with the letter L in the testfile file, enter the following command:
Look L testfile
The content in the original file testfile is as follows:
$ Cat testfile # view the content of the testfile
Hello linux!
Linux is a free unix-type opterating system.
This is a linux testfile!
Linux test
Use the look command in the testfile to search for words starting with "L". The result is as follows:
$ Look L testfile # search for words starting with "L"
Linux is a free unix-type opterating system. # The second line starts with "L" and lists the entire sentence.
Linux test # Line 4 starts with "L" and lists the entire sentence