Linux look Command
The Linux look command is used to look up words.
The look command is used to look up English words. You only need to give it the prefix string you want to search for, and it will display all words whose beginning matches that string.
Syntax
look [-adf][-t<字尾字符串>][字首字符串][字典文件]
Parameter Description:
- -a Use an alternative dictionary file, web2, which is also located in the /usr/dict directory.
- -d Compare only English letters and digits, ignoring all other characters.
- -f Ignore differences in character case.
- -t
Set the suffix string.
Example
To find all lines in the testfile file that begin with the letter L, enter the following command:
look L testfile
The contents of the original testfile are as follows:
$ cat testfile #查看testfile 文件内容
HELLO LINUX!
Linux is a free unix-type opterating system.
This is a linux testfile!
Linux test
Use the look command on the testfile to find words starting with "L"; the result is as follows:
$ look L testfile #查找以“L”开头的单词
Linux is a free unix-type opterating system. #第二行以“L”开头,列出全句
Linux test #第四行以“L”开头,列出全句
Linux Command Reference