What is look?
3 look examples
Syntax and Options
Related Commands
What is look?
look command is used to display strings that begin with the given strings.
In other words, look command can be used to check the spelling of a word, by giving the words prefix.
3 look examples
Check spelling using look command
For example, if you are not sure whether ‘exclaimation’ or ‘exclamation’ is the correct spelling, you can use look command with first few characters of the word.
$ look excla exclaim exclaimed exclaiming exclaims exclamation exclamation's exclamations exclamatory
This displays the word that starts with the given prefix from file /usr/share/dict/words.
Check spelling for a word from user defined file
When you want to know the spelling of a word which has the prefix ‘excl’.
$ look excl myfile exclaimed exclamation
This displays the word that starts with the given prefix from file myfile.
Ignore case while searching for spelling of word
When you want to know the spelling of a word which has the prefix ‘excl’.
$ look excl myfile exclaimed exclamation EXCLAMATORY
This displays the word that starts with the given prefix from file myfile by ignoring the case.
Syntax and Options
Short Option | Long Option | Option Description |
---|---|---|
-b | Use a 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. See sort(1) for more information on sorting files | |
-d | –status | Dictionary character set and order, i.e. only alphanumeric characters are compared |
-f | Ignore the case of alphabetic characters | |
-t | Specify a string termination character, i.e. only the characters in string up to and including the first occurrence of termchar are compared |