look command in Linux with Examples
The look command in Linux shows the lines beginning with a given string. This command also uses binary search if the file is sorted. If file is not specified, the file /usr/share/dict/words is used. And then only the alphanumeric characters are compared and the case of alphabetic characters is ignored.
Syntax:
look [-bdf] [-t termchar] string [file ...]
Example:

Options:
- -[string]: This option is used to search for the given string in a specified file.
Example:
look "include" Assignment.c

- -f : This option is used to ignore case of alphabetic character.
Example:
look -f ab words

- -t: This option is used to specify a string termination character, i.e., only the characters in string up to and including the first occurrence of character are compared.
Example:
look -t b abu words

- -d: This option is used to compare only alphanumeric characters.
Example:
look -d ab words
- -bd, -bf: This option uses binary search on the given word list. If you are ignoring case with -f or ignoring non-alphanumeric characters with -d, the file must be sorted in the same way.
Example:
look -bf ab words
- -h: This option is used to show the help message and exit.
look -h
- -V: This option is used to show the version information and exit.
look -V
Recommended Posts:
- man command in Linux with Examples
- apt-get command in Linux with Examples
- last command in Linux with Examples
- Cat command in Linux with examples
- until command in Linux with Examples
- sum command in Linux with Examples
- gdb command in Linux with examples
- cvs command in Linux with Examples
- df command in Linux with Examples
- wc command in Linux with examples
- pwd command in Linux with Examples
- du command in Linux with examples
- w command in Linux with Examples
- env command in Linux with Examples
- ed command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



