Although the Linux find command does a fabulous job for searching on the command line, there may be situations where a dedicated tool may be more convenient. One such case is to find lines in a file that start with a particular word. There exists a command – dubbed look – that does this for you.
In this tutorial, we will discuss this command using some easy to understand examples. But before we do that, it’s worth mentioning that all examples in the article have been tested on an Ubuntu 18.04 LTS machine.
Linux look command
The look command in Linux displays lines beginning with a given string. Following is its syntax:
look [-bdf] [-t termchar] string [file …]
And here’s what the man page says about the tool:
The look utility displays any lines in file which contain string as a prefix. If file is not specified, the file /usr/share/dict/words is used, only alphanumeric characters are compared and the case of alphabetic charac? ters is ignored.
Read more at HowToForge